Build Debian Almquist Shell (dash) for OS X (GNU bash ShellShock part 2)

Even after pushing bash to 4.3.26, the aftershock of ShellShock (pun intended) is still there, as a developer commented that even the bash43-026 patch is still a “whack-a-mole” job.

Since my other main operating system is Ubuntu and the 3rd most common used is Debian jessie/sid, I am replacing /bin/sh with dash, Debian Almquist Shell, at least for now.

To build dash-0.5.8 on OS X, I need to first build 4 GNU packages: autoconf-2.69, automake-1.14, m4-1.4.17 (maybe I can live without this package as OS X Developer Tools included a version of GNU M4) and libtool-2.4 (OS X Developer’s libtool is not compatible with this.)

The build and install is straightforward:

./ # This is where those GNU tools are called for
CC=clang ./configure --prefix=/usr --enable-fnmatch --enable-glob --with-libedit # dash does have its roots at NetBSD Almquist Shell, so the full set of BSD libraries on OS X can help a lot, allowing enabling *everything*
make -j4 -k
sudo make install
sudo mv {/usr,}/bin/dash # This is bashism, I do have to start this from bash-4.3.26 after all

And if you are really hitting the square, hoping to close the ShellShock hole by breaking some compatibilities,

sudo ln -sf dash /bin/sh

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.