Awesome Terminal upgrades - Part One: Upgrade and use a newer version of BASH on macOS
Mr F.
Posted on December 15, 2019
This is part one in the "Awesome Terminal upgrades" series. In this short tutorial we will cover BASH on macOS and how you can upgrade and manage it using Homebrew.
Install Homebrew
The missing package manager for macOS (or Linux)
We will be using Homebrew to manage everything for us, if you don't have it installed, go ahead and do it now!
echo “[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion” >> ~/.bash_profile
Upgrade and use a newer version of BASH on macOS
As of macOS Catalina, the default shell is set to ZSH.
The default version of BASH on macOS is 3.2 which is ancient!
We'll be installing and using version 5 and making it our default shell instead.
brew install bash
sudo vim /etc/shells
You’ll see some output that looks like this:
/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
We need to update it:
- Use your keypad to go down to the last line and press
i
to edit this line - Type in
/usr/local/bin/bash
- Type
:wq
to writeout the file and quit.
Change your default shell to BASH
sudo chsh -s /usr/local/bin/bash
After that, restart your Terminal to have it take effect.
Make sure BASH knows where to source everything from
In order to make sure all of the above stick and work whenever you fire up a terminal, add this line to the top of your ~/.bash_profile
file.
[ -r ~/.bashrc ] && . ~/.bashrc
Awesome, your shell is now using BASH managed by Homebrew!
You can update BASH whenever you like, as well as you other Homebrew installs by running:
brew update && brew upgrade
Posted on December 15, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
December 15, 2019
December 15, 2019
December 15, 2019
December 15, 2019
December 15, 2019