How can I add support for .flac files in SoX? I want SoX to record audio in .flac files. When I do:

rec -t flac ~/Desktop/myrec.flac


…it gives the following error:

rec FAIL formats: no handler for given file type `flac'


I have installed SoX from 'brew' and and I do have flac 1.2.1 installed.

I have gone though man pages at http://sox.sourceforge.net/sox.pdf but did not get the information that I am looking for.

How can I add support for .flac files?

I am on OS X 10.9.3
Keeping it simple. 

Removing it using brew like so :

brew remove sox


Then installing it again with specific options, like so, did the trick for me:

brew install sox --with-lame --with-flac --with-libvorbis


You may want to remove the --with-lame option if you won't be using MP3s, or the --with-libvorbis if you won't be using OGG.

I hope this helps someone.