5

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.

  • 1
    There are a lot of things in the question, can you please focus on one question per post? – nohillside Dec 19 '19 at 9:57
  • Having said that: /bin/bash isn't going away, your current account as well as all shell script will work as before. – nohillside Dec 19 '19 at 9:57
  • You should find answers on how to change shells on this site, information about non-compatible changes between bash3 and bash5 should be available on the usual sites. – nohillside Dec 19 '19 at 10:01
  • I've updated the question - please could you re-open it. I'm not looking for information on the differences, just the simple question if it's OK to upgrade bash on Catalina – Peter Brooks Dec 19 '19 at 10:34
  • 1
    Independent of the desire to use Bash 5 rather than Bash 3, if you simply want to use Bash rather than Zsh, as was the default prior to Catalina, you can change your default shell to Bash with chsh -s /bin/bash and suppress the Bash deprecation message. – Jivan Pal Dec 20 '19 at 15:33
13

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.

3

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.

  • 1
    I'll pick one nit here, Homebrew will not upgrade /bin/bash, it will install a new version in parallel (aka side-grade) in /usr/local/bin, the path is listed, but somebody coming here to learn could misinterpret the sentence "You can update bash via homebrew" – RayInNoIL Dec 20 '19 at 13:58
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .