Skip to content

Instantly share code, notes, and snippets.

@goodarzi
Last active November 1, 2023 18:11
Show Gist options
  • Save goodarzi/e2e8d03574a7a5c0d12f214535639b8c to your computer and use it in GitHub Desktop.
Save goodarzi/e2e8d03574a7a5c0d12f214535639b8c to your computer and use it in GitHub Desktop.
Install Bash 5.2 on macOS
# Install bash using HomeBrew
brew install bash
# Add new Bash to macOS shell list
sudo echo -e "/usr/local/bin/bash\n" >> /etc/shells
# Setup macOS .bashrc
[[ -f ~/.bashrc ]] || touch ~/.bashrc
grep -v '^\s*#' ~/.profile | grep '\. ~/\.bashrc\|source ~/\.bashrc' || echo -e "\n[[ '\$BASH' && -f ~/.bashrc ]] && . ~/.bashrc\n" >> ~/.profile
# Change default shell to Bash
chsh -s /usr/local/bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment