Apple - Update bash to version 4.0 on OSX

Is it possible to actually update bash to version 4.0 in OSX Yosemite? Yes.

  1. Download / Install homebrew by running this command in terminal.

    ruby -e "$(curl -fsSL"
  2. Quit and reopen your terminal. then type

    brew install bash
  3. Change the default shell via the terminal gui with the literal path of your new bash (EDIT: I have yet to find a CLI way that works )

enter image description here

Is it possible to actually update bash to Apple’s provided bash version 4.0 in OSX Yosemite?

EDIT: No. Not in the way the op is asking. E.g upgrade the current install by way of replacing itself. It has been noted in other answers that Apple has not updated bash due to licensing issues. However downloading an updated and separate version of bash and using it as your default shell is the canonical solution, for most interpreters. Take python for example. You do not upgrade 2.7 to 3.5 you download a separate version and change your default.

As @William said in his answer, Apple does not provide bash 4 due to GPL restrictions. You can install bash 4+ however and also can make it your default shell (including for Terminal and iTerm2) by doing the following.

Install Bash 4 via Homebrew

First install the newer version of bash. There are various ways of doing that, I prefer Homebrew.

  • Install Homebrew as described at
  • Install bash using brew install bash.

Bash 4 is now available on your PATH (assuming Homebrew bin is on your path). However, it is not yet your default shell. You can find where it is located by running which bash. In my case it is at /usr/local/bin/bash.

Using Bash 4

Since it is on your PATH, you can start a Bash 4 session with just bash or it can be used in scripts by using a Shebang.

For example, this will use a specific bash instance.

...your script...

This will use the first bash on the PATH.

#!/usr/bin/env bash
...your script...

You can also set the bash path for specific profiles in Terminal/iTerm2 using the steps described in @user136952's answer.

Making Bash 4 the default

As mentioned above, after installing Bash 4 is still not the default shell. To make bash the default you need to do two more steps.

First, add the Bash 4 path to your /etc/shells file so that it is an allowed login shell. As described in /etc/shells, this file has the list of valid login shells. After adding the new bash path my /etc/shells looks like the following:

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.


Next we use chsh to make it your default shell. So any sessions for that user will use that shell. You can read more about this in Change the Shell in Mac OS X Terminal, but the actual command is very straightforward.

chsh -s /usr/local/bin/bash

Now the new bash is our default login shell. If you open Terminal or iTerm2 and run bash --version you should see the new version. Note the "License GPLv3+" which is why Apple doesn't bundle it with macOS.

$ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.6.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>

Apple will not update Bash, because the latest version is licensed under GPLv3, which Apple cannot use. They have updated most of their other shells though. ZSH for example is mostly up to date.


After a bit of research, this seems like the primary issue:


When people distribute User Products that include software under GPLv3, section 6 requires that they provide you with information necessary to modify that software. User Products is a term specially defined in the license; examples of User Products include portable music players, digital video recorders, and home security systems.

This would require that otherwise closed-source software, have its GPL'd portions be made modifiable by the public, which would obviously be an issue for Apple.