Upgrading Bash and zsh on OS X


Here is a brief description on how to update to newer versions of Bash and zsh on OS X.

Few hours after I wrote some notes on Customizing terminal emulator and the like on OS X, I just decided to update my old version of Bash (believe it or not, I was still using the one that shiped with my MacBook Air when I got it two years ago, i.e. 3.2.48!). There are quick tutorials for installing Bash by little googling. I followed this one, and everything worked fine: Change to new BASH Shell (4.1) for Mac OS X. Just make sure to grab the latest version of Bash from a GNU server. The last points (6-12) are important if we want to make the system aware of our new interpreter.

For zsh, I downloaded the master zipball from GitHub. The install instructions in the INSTALL file contains everything that is needed to compile zsh, with the following minor exception: I got an error compiling the documentation which is contained in zsh.texi. According to this thread on Stack Overflow, we need Yodl on OS X. And, of course, to compile Yodl you need yet another program: icmake. If you don't really care about the manpages and the help manual, you can skip what follows, and just follow with

$ make check
$ sudo make install

We can check that we now have the latest version of zsh:

$ /usr/local/bin/zsh --version
zsh 5.0.0 (x86_64-apple-darwin11.4.0)

As I am using iTerm2, I just configured this new version as my default zsh interpreter in the Preferences panel.

We can then launch an new Terminal and see whether everything is working:

% print $ZSH_VERSION

(AFAIK, there's no help command like in Bash.)

To compile icmake, you will have to replace every #define by export (if you are using Bash) in INSTALL.im, and you might want to change the target directories (I prefer to put everything in /usr/local), but that's not necessary: Just run

$ ./icm_bootstrap /usr/local/share/icmake-7.16.00
$ sudo ./icm_install all
$ sudo ln -s /usr/local/share/icmake-7.16.00 /usr/local/share/icmake

and add /usr/local/share/icmake to your PATH, e.g. for this session

$ export PATH="/usr/local/share/icmake:$PATH"

One can also symlink executables to a more convenient place, e.g. /usr/local/bin.

Then, proceed with Yodl

In INSTALL.im, change the install directory in setLocations() at the end of the file. E.g., I used

BASE    = "/usr/local";

Please note that the build program assumes that icmake is located in /usr/bin. How funny? So, let's change the shebang line so that it now reads

#!/usr/local/share/icmake -qt/tmp/yodl

I stopped here myself because there's a problem with compiling yodl that I don't have time to investigate more carefully. I will update this section later!

Yes, I promise: One day I will switch to Homebrew :-)


Articles with the same tag(s):

El Capitan
Why I am still using Emacs
Tmux and OS X
OS X Yosemite
Some useful Mac Apps for data scientists
Collecting email usage statistics from mu
From Beamer to Deckset
Fixing some critical keyboard shortcuts in OS X terminal
A modular configuration for Emacs
Common lisp on Mavericks