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!

5 thoughts on “Building sox with mp3 support on OSX (old)

  1. Kirk

    Err, how would one build with mp3 support using homebrew? brew install sox –with-mad –with-lame
    doesn’t do it

    Reply
  2. admin Post author

    Someone reported successfully using using Homebrew here:

    http://superuser.com/questions/246918/why-isnt-sox-able-to-convert-to-mp3

    I also edited my original post to remove the statement that there’s a “need to compile the libraries from source” because there’s people that disagree. I’m not claiming that the method in my post will work for everyone although it does work for me and seems to have helped others as well. It would be useful if you could clarify the point in which you get stuck when following the above recipe. BTW, which OSX version are you on?

    Best

    Reply
  3. Pingback: Building sox with mp3 support (UPDATED). Works on OSX 10.9 Mavericks. |

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>