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.
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
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
ito edit this line
- Type in
:wqto writeout the file and quit.
sudo chsh -s /usr/local/bin/bash
After that, restart your Terminal to have it take effect.
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
[ -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