Building Extras on Mac
FFmpeg
You will need to build for 64 bit and as dynamic link. Note that after configuring the configure report will appear to suggest that you are not building 64 bit, but in fact you are, and you can check this by using the file command, and the fact that Audacity will actually run and work with this version of ffmpeg.
1. Install Homebrew. 1a. Note that this will bork your xcodebuild configuration, since it installs command line tools. See later section for the fix. 2. Install lots of other stuff This page https://trac.ffmpeg.org/wiki/CompilationGuide/macOS recommends you install: brew install automake fdk-aac git lame libass libtool libvorbis libvpx \ opus sdl shtool texi2html theora wget x264 x265 xvid nasm However this leads to problems on systems which don't have these, so you should at least leave out sdl. 3. Download the correct ffmpeg source code version. It's 2.2.2. The later versions will not work. tar -xvf 3a.? Before configuring: export LDPATH="-L/usr/local/lib" CFLAGS="-I/usr/local/lib" 4. ./configure --arch=x86_64 --extra-cflags=-m64 --extra-ldflags=-m64 --disable-static --enable-shared --enable-rpath 5. make install 6. Now use install_name_tool to change the absolute /usr/local/lib paths into @rpaths, so that the 3 dylibs you want can be used from any directory. More details shortly. Change id as well. 7. Now use the finder menu to find the .dylinks, select the ones you want INCLUDING symbolic links, and use the context menu to Compress them to a zip archive (that includes the symbolic links).
Some useful commands for checking things:
which ffmpeg to find out where ffmpeg is actually running from. file name-of-file to check that the file is built for 64 bit. otool -L filename to check what the dependencies are. otool -l filename to check where rpath dependencies are being looked for.
ffmpeg .pkg
To go from having the files that work to a simple package that will put them where you want, you need to make a .pkg
1. Place the files into a directory structure under say ~/Desktop/ffmpeg that has the desired on disk directory structure.
for example, most of the ffmpeg files will live in
~/Desktop/ffmpeg/Library/Application_Support/audacity/libs/
I chose to put the GPL license as a readme in
~/Desktop/ffmpeg/Library/Application_Support/audacity/docs/
If you are keen to research it, there are more elaborate ways of doing things that mark the readme as a readme so that
it is shown by the installer.
2. Clean up the files. We need to change the owner and remove the .ds files:
Be sure to start in the right directory, ~/Desktop/ffmmpeg.
sudo chown -R root:admin *
sudo find . --name '*.DS_Store' -type f -delete
3. Use the following packager command:
pkgbuild --root ~/Desktop/ffmpeg --ownership preserve --identifier org.audacityteam.ffmpeg --version 1.0 ffmpeg_mac_64bit2.2.2.pkg
rename as e.g. ffmpeg_mac_64bit2.2.2rc002.pkg, if this is being used for testing.
The resulting package will install files in /Library/Application_Support/audacity/libs
The steps for LAME are almost identical. There is just one file in LAME and currently no readme (since we offer the dylib raw too)
Deborking Xcodebuild
To fix that so that you can use xcodebuild again, not needed for FFmpeg though, use the following: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer Your adventure has only just begun. You will be able to build Audacity, but noone else will be able to use it. Your problem is that /usr/local, created by Homebrew, contains wxWidgets dylibs that xcodebuild will link to. Other people won't have them. otool -L will show these, if you examine the Audacity exe. IF you could move /usr/local out of the way, you could build Audacity self-contained. OSX will not let you move /usr/local out of the way because of system integrity protection (SIP). To disable system integrity protection you need to reboot in recovery mode. You cannot reboot in recovery mode because the recovery partition is hidden. That partition is hidden because of coreStorage hiding it. so: diskutil cs list which tells you the coreStorage volume names. Then diskutil coreStorage revert lvUUID where lvUUID is the last lvUUID reported by the previous Terminal command. Now you can reboot the mac, and hold Alt (or Option) down as it reboots. You can now choose the recovery drive. In recovery drive, from utilities menu, open terminal. In terminal csrutil disable This is to disable sip. Close the 'recovery utility' window, and when you do so, it prompts you for the boot drive, and choose the normal one again. Now reboot. Now you can rename /usr/local to /usr/local.bak Your troubles are not over. To be continued....