Monthly Archives: January 2013

Building sox with mp3 support on OSX (old)

The instructions in this post have been updated, here.

Hi, it took me a bit to figure out how to build sox with mp3 support on OSX, so I thought that sharing how I did it might help others:

1. Download sox, and the lame and libmad tarballs: sox-14.4.1, lame-3.99.5, libmad-0.15.1b. There’s people that claim that it is possible to take advantage of a preexisting installation of the libraries but that didn’t work for me. What works on my system (OSX 10.6.8 / MBP i7 / 64-bit kernel) is to build all three from source forcing a 32-bit build (libmad is a bit old):

2. Build libmad using the following configure flags:

./configure CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --enable-shared --disable-static
sudo make
sudo make install

3. Build lameĀ using the following configure flags:

./configure CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --enable-shared --disable-static
sudo make
sudo make install

4. Build sox with libmad and lame support using the following options:

./configure CFLAGS="-m32 -arch i386" LDFLAGS="-arch i386" --with-mad --with-lame
sudo make -s
sudo make install

After running the ./configure line in step #4 you should check the list of optional file formats to make sure that everything went well, i.e. mp3 is now active (“mp3=yes”):

Disclaimer: this may or may not work for you. On my computer the previous steps produce a fully functional sox binary with mp3 encoding/decoding capabilities. With this post I am trying to help to the best of my knowledge, but don’t make me responsible if those instructions fail to work for you or even break your computer.

Good luck!