Building On Mac

Download Xcode 3.x
To download Xcode, you will need to register at the Apple Developer site:


 * http://developer.apple.com

Once registered, the available downloads are located here:


 * http://developer.apple.com/downloads

Xcode 3.2.6 is the last version that officially supports the PPC architecture and the macosx10.4u SDK. Unless you're building release versions, the PPC support isn't absolutely necessary, but the SDK is required.

If you are running Leopard, then enter "Xcode 3.1.4" in the search box on the left, press enter, and download the "Xcode 3.1.4 Developer DVD" dmg.

If you are running Snow Leopard or newer, enter “Xcode 3.2.6” in the search box on the left, press enter, and download the “Xcode 3.2.6 and iOS SDK 4.3” dmg:


 * Bom xcode 326 download.png

Download Xcode 4.5.2
Enter “Xcode 4.5.2” in the search box on the left, press enter, and download the “Xcode 4.5.2” dmg:


 * Bom xcode 452 download.png

Enter “Command Line Tools” in the search box on the left ("try "command" if you get no results), press enter and download the latest “Command Line Tools” dmg that corresponds to your version of OS X:


 * Bom tools 452 download.png

Download wxWidgets
You must download the wxMac version 2.8.12 of wxWidgets from:


 * http://www.wxwidgets.org/downloads/



Download the "[[Media:Build wxwidgets.gz|Build wxwidgets.gz]]" script that will be used to build wxWidgets for use with Audacity. Make sure you save the file as "build_wxwidgets.gz". Safari will automatically uncompress the file, others may not.

Download cmake
Download the latest Unix/Linux source version of cmake from:


 * http://www.cmake.org/cmake/resources/software.html



Download pkg-config
Download the latest version of pkg-config from:


 * http://pkgconfig.freedesktop.org/releases/



Install Xcode 3.x
Locate the previously downloaded Xcode 3.x dmg on your system and double click it to have Finder verify and mount it:



The Xcode 3.2.6 installer checks the version of OS X that is currently running and that check will not succeed on versions above Snow Leopard. However the version check can be bypassed by starting the installation from the command-line.

Open a Terminal window and start the installation by entering the following commands:

For Leopard:


 * open "/Volumes/Xcode Tools/XcodeTools.mpkg"

For Snow Leopard or newer:


 * export COMMAND_LINE_INSTALL=1
 * open "/Volumes/Xcode and iOS SDK/Xcode and iOS SDK.mpkg"



This will start the installation while bypassing the version check.

On Mountain Lion, the installer needs to restart itself:



And, since the Xcode 3.2.6 certificate has expired, you will be asked to accept it:



You will then get to the normal installation process:



Proceed through the various installation pages until you get to the “Custom Install” page:



Open the Essentials item by clicking the arrow:



The minimum required options are “Unix Development” and “Mac OS X 10.4 SDK”, but if you're running Snow Leopard, you may elect to install everything. On Lion or above, you will not be able to use “System Tools” and may choose to use the “iOS SDK” and “Documentation” from Xcode 4.5.2:



Continue through the pages to start the installation.

On Mountain Lion, you will be prompted to stop iTunes near the end of the installation:



To terminate the process and allow the installation to complete, open a Terminal window and enter:


 * sudo killall iTunesHelper



Close the installer when complete:



then eject the Xcode 3.x dmg.

The first time you use Xcode you will be prompted to install Java if you do not have it installed already. So, use Finder to navigate to the "/Developer/Applications" folder, by selecting "Go to folder" from the "Go" menu in Finder:



Enter "/Developer/Applications" for the path and click "Go":



Now double-click the "Xcode" application to start it:



At this point you may prompted to install Java:



Wait for the installation to complete and quit Xcode.

This completes the Xcode 3.x installation.

Install Xcode 4.5.2
Leopard and Snow Leopard users should skip this step.

Locate the Xcode 4.5.2 dmg, xcode4520418508a.dmg, on your system and double click it to have Finder verify and mount it:



The Xcode folder will open when it's mounted:



You may choose to drag the Xcode app to wherever you like, but this guide expects it to be located in the Applications folder:



Locate the Command Line Tools dmg, xcode452cltools10_76938212a.dmg, on your system and double click it to have Finder verify and mount it:



The Command Line Tools folder will open:



Start the installation by double clicking the installer, “Command Line Tools (Lion).mpkg” in this case:



Once the installation completes, close the installer:



and you may eject the Command Line Tools .dmg.

In the Terminal window, enter:


 * sudo xcode-select -switch "/Applications/Xcode.app/Contents/Developer"



You will be asked to enter your password:



To make it a little easier to use Xcode 3.2.6 from the command-line, create a link to the 3.2.6 version of xcodebuild. You make change the "xcodebuild3" to whatever you like, just remember when building Audacity from the command-line to use what you specify here:


 * sudo ln -s /Developer/usr/bin/xcodebuild /usr/bin/xcodebuild3



This completes the Xcode 4.5.2 installation.

Install cmake
In the Terminal window, extract the cmake archive if it was not extracted on download (modify the cmake version number in the command if needed):


 * tar xf ~/Downloads/cmake-2.8.10.2.tar

Now change to the directory of the extracted cmake:


 * cd cmake-2.8.10.2

or if you had already extracted cmake:


 * cd ~/Downloads/cmake-2.8.10.2

Configure cmake:


 * ./configure --prefix=/usr/local --docdir=/share/doc/CMake --mandir=/share/man



Build cmake:


 * make



Install cmake:


 * sudo make install



This completes the cmake installation.

Install pkg-config
As with cmake, use the Terminal to extract the pkg-config archive and change to the extracted directory:


 * tar xf ~/Downloads/pkg-config-0.27.1.tar
 * cd pkg-config-0.27.1



or if you already extracted pkg-config, change to that extracted directory:
 * cd ~/Downloads/pkg-config-0.27.1

Now configure pkg-config:


 * sh configure --with-internal-glib



and build pkg-config:


 * make



Install pkg-config:


 * sudo make install



This completes the pkg-config installation.

Install wxWidgets
In the Terminal, extract the wxWidgets source if not already extracted:


 * tar xf ~/Downloads/wxMac-2.8.12.tar



Change to the extracted directory:


 * cd wxMac-2.8.12


 * or:


 * cd ~/Downloads/wxMac-2.8.12



Start the build. This assumes you downloaded the build_wxwidgets script to your Downloads directory:


 * sh ~/Downloads/build_wxwidgets



After all configurations are built, you will be prompted for your password. Watch the build for the password prompt, because if the requests for a password time out, you'll have to build again:



All configurations have been built and installed: ~/Downloads/wxMac-2.8.12 ~/Downloads/wxMac-2.8.12/bld_release_shared ~/Downloads/wxMac-2.8.12



To verify, list the installed configurations:


 * wx-config --list



Make sure you see 1 default configuration (mac-unicode-release-2.8) and 3 alternates:



wxWidgets installation is now complete.

Create links
To make it easier for Xcode to find the cmake, pkg-config, and wx-config, create links to them in the Xcode developer tree:


 * sudo ln -s /usr/local/bin/pkg-config /Developer/usr/bin
 * sudo ln -s /usr/local/bin/cmake /Developer/usr/bin
 * sudo ln -s /usr/local/bin/wx-config /Developer/usr/bin



Download Audacity
Now that everything is in place, we finally get to the whole purpose of this exercise, building Audacity. But first, you must decide if you want to use the tarball or tagged source which gives you the current release of Audacity, or if you want to get the absolute latest development source (SVN HEAD).

Make your choice when downloading from here:


 * http://audacity.sourceforge.net/download/source



Once you have the source downloaded and extracted, you may use either the xcodebuild command-line utility or the Xcode 3.2.6 IDE.

The Audacity xcode project has four configurations defined:


 * Debug Static - disables optimization, enables debugging code, and links to static libraries
 * Debug Shared - disables optimization, enables debugging code, and links to shared libraries
 * Release Static - enables optimization, disables debugging code, and links to static libraries
 * Release Shared - disables optimization, disables debugging code, and links to shared libraries

So you'll need to select which one you want to use in the following steps, but "Debug Static" will be used for this guide.

Build with xcodebuild
To use the command-line utility, open a Terminal window, change to the Audacity mac directory, and start the build. If you didn't install Xcode 4.5.2 above, then use "xcodebuild" here in place of "xcodebuild3":


 * cd audacity/mac
 * xcodebuild3 -configuration "Debug Static"



When it completes, you should get a "Build Succeeded" message:



The newly built Audacity can be started from Finder, using gdb, or simply:


 * open "build/Debug Static/Audacity.app"



Build with Xcode IDE
To build Audacity using the Xcode 3.2.6 IDE, use Finder to navigate to the "/Developer/Applications" folder, by selecting "Go to folder" from the "Go" menu in Finder:



Enter "/Developer/Applications" for the path and click "Go":



Now double-click the "Xcode" application to start it:



Open the Audacity Xcode project by selecting "Open" from the "File" menu in Xcode:



Navigate to the "audacity/mac" folder and then double-click the "Audacity.xcodeproj" project:



Now choose the configuration required from the menu top left (underneath the window buttons), then click "Build and Run" on the toolbar. A freshly built Audacity will launch when the build completes.