15

OS X comes with bash version 3.2.57 instead of bash version 4.3.39, which GNU lists as the current stable release of bash.

Is there any way to upgrade bash on Mac OS X?

1

1 Answer 1

14

Note the original question asked why Apple shipped an old version of bash and then asked how to upgrade. This is an answer to the original. If the question is just the latter then it is a duplicate

You would have to ask Apple as to why. However I would note that bash is now licensed under GPLv3 and 3.2.57 is the last version released under GPL2.

As bash is in /bin you should not replace it directly as this can be updated or modified by Apple at any time and now with SIP it is also more difficult to change. Also scripts elsewhere might depend one this version

You can however add bash from GNU or from a package manager like Macports or Homebrew. You can then change the Terminal.app profile to start this shell rather than bash

Macports is

sudo port install bash

Homebrew is

brew install bash

As of 14/6/16 - the stable version of bash is 4.3.42 and updates usually come rapidly through both port systems.

Or you could change your shell to another that Apple supplies e.g. zsh which is more powerful than bash (version up to date of release of El Capitan) or ksh which is upto date. (or tcsh which is a C shell but also reasonably up to date)

3
  • Nice answer! Very good explanation. How can I change to zsh? Is anywhere a good manual of this shell? Thanks a lot!
    – user161254
    May 14, 2016 at 10:08
  • Worth noting that ksh and tcsh are both pretty old shells with a very small following. For those wanting a bash alternative, zsh and fish are more modern and quite commonly recommended. zsh is the default shell in macOS since Catalina in 2019. See this graph on Stack Overflow trends for bash, zsh and ksh popularity - the others don't have tags.
    – RichVel
    Sep 28, 2022 at 16:33

You must log in to answer this question.