upgrading bash on OS X
If you've noticed that the bash that comes with OS X is outdated and you're bothered by it, this post is for you. First, install macports if you don't have it already. Open a terminal (I prefer iTerm but the default one will do just fine) and get a root shell:
- $ sudo -s
- # port -cv install bash
- # echo /opt/local/bin/bash >> /etc/shells
- chsh -s /opt/local/bin/bash
In order to load your .bashrc automatically on each terminal tab you need to do one more thing (as root):
- # chmod u+w /etc/bashrc
- [ -f "$HOME"/.bashrc ] && . "$HOME"/.bashrc
Category: OS X



Discussion
the same is possible with brew
brew install bash
it will be installed in:
/usr/local/Cellar/bash/4.2.8/bin/bash
but one last step is missing. to be sure the new bash is used an update on $PATH is needed
export PATH=/usr/local/Cellar/bash/4.2.8/bin/bash:$PATH
this will allow you now to use bash --version :-)
Thanks, sam.
The version number in the PATH doesn't look right. How about adding /usr/local/bin instead? I think that homebrew already creates a symlink there for installed packages.
hey stefan,
good point. i didn't checked /usr/local/bin yet.
Leave a Comment :
Leave a Comment