Skip to content

Instantly share code, notes, and snippets.

@noahcoad
Last active May 7, 2019 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noahcoad/deac4ffb3f9b24c714f7bc6aa4323204 to your computer and use it in GitHub Desktop.
Save noahcoad/deac4ffb3f9b24c714f7bc6aa4323204 to your computer and use it in GitHub Desktop.
Upgrade bash on OSX

Upgrade bash on OSX

Due to GPL limitations, OSX ships with bash v3.2.57. As of writing this the current version is bash v5.0.2. bash v4 and beyond support unicode characters, and much more.

Check current bash version with:

echo $BASH_VERSION

To upgrade use Homebrew

brew install bash

Add new bash to list of approved shells:

sudo nano /etc/shells

Add this line to the top of the list:

/usr/local/bin/bash

Change the shell to use the new version:

chsh -s /usr/local/bin/bash

Change bash scripts from using this at the top:

#!/bin/bash

To use the newest version:

#!/usr/bin/env bash

Open a new terminal window and test you're using the latest version:

echo $BASH_VERSION

For more information, see also: Upgrade to bash 4 in Mac OS X

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment