Now that MacOS Catalina has moved to zsh, can I upgrade bash 3.2.57 with 5.0.3?

I understand apple's move from bash to zsh, though I'd really rather that they hadn't made the change.

I've tried zsh, and decided that I'd prefer to remain with bash.

So, since MacOS Catalina isn't using /bin/bash any more, am I going to run into any problems if I replace it with the new version? ( 3.2.57 with 5.0.3 ).

I wouldn't have thought of doing this before, because it would have been quite possible that some part of the OS relied on a feature that had changed in new versions.

Now, though, that /bin/bash isn't officially used, can we change it?

If so, that would be a really positive side-effect of the move to zsh. We can keep our user accounts compatible with out linux accounts, all using zsh, and keep the latest version running on all our machines, without having any danger of a conflict with the OS.


You can't easily (and shouldn't) change/upgrade /bin/bash. You can install a more recent version of bash through Homebrew though, and use the information from How to use bash as default shell to change your login shell.

This will not break any existing bash scripts as these refer to #!/bin/bash in the first line.


You can install the latest bash via homebrew. There is already a guide on how to install it via homebrew.

Install brew via:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After installing fetch the latest version of bash via brew.

Usage:

$ brew install bash installs the latest version of bash.

Binaries in /{,usr/}{,s}bin/ should not usually be replaced with other files. Other programs expect them to be the versions that came with OS X, and they are replaced by OS upgrades.

After running brew install bash, you can change the default shell safely by:

  • Adding /usr/local/bin/bash to /etc/shells
  • Running chsh -s /usr/local/bin/bash.

Running bash -version should now display the latest version.


Catalina is no longer using bash as the default shell for new accounts. /bin/bash will still remain there, so that existing scripts that call it will still work without modification.

/bin contains csh, ksh, sh, as well as bash and zsh.

You can of course install a newer version of bash, and modify your existing scripts (or your shell environment) to use that instead. There may be differences between the old and new versions that require script modification.