Jun
12
Getting Back to Bash from Zsh on MacOS
Filed Under Computers & Tech, System Administration on June 12, 2019 at 3:25 pm
At Apple’s advice I’ve switched the login shell from Bash to Zsh on all my Macs. For the most part, what worked in Bash works in Zsh, but sometimes I do still want to get back to Bash to test something or to check something. You might imagine that simply typing bash
from a Zsh prompt would get you a Bash shell, and you’d be right, sort of. When you just run the command bash
you get a bare shell without the customisations that would have been applied when you opened a new Terminal window with Bash as your default shell. This will be immediately obvious because the prompt will be the basic bash-3.2$
as opposed to the hostname, current folder, and you’re username like you were used to.
The solution is really simple — pass the -l
flag to signify that you want your new shell treated like a login shell, and hey presto, you’re back to Bash just like you remembered it 🙂
So, if you switch your Mac to Zsh, you get back to the Bash experience you had before with the following command:
bash -l