Skip to content

Instantly share code, notes, and snippets.

@goldenratio
Last active October 14, 2024 21:07
Show Gist options
  • Save goldenratio/08262b8126c701253c52c606c4b776ef to your computer and use it in GitHub Desktop.
Save goldenratio/08262b8126c701253c52c606c4b776ef to your computer and use it in GitHub Desktop.
Upgrading Bash on macOS

Install Homebrew

$ brew install bash

$ which -a bash

/usr/local/bin/bash 
/bin/bash

$ /usr/local/bin/bash --version

GNU bash, version 5.0.0(1)-release (x86_64-apple-darwin18.2.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ /bin/bash --version

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.

Whitelist

$ sudo vim /etc/shells

add the /usr/local/bin/bash shell to its content, so that the file looks something like this:

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/bash

Set Default Shell

$ sudo chsh -s /usr/local/bin/bash

$ echo $BASH_VERSION

5.0.0(1)-release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment