Difference between revisions of "Building On Mac"

From Audacity Wiki
Jump to: navigation, search
(Building Audacity)
(Building with the Xcode IDE)
Line 251: Line 251:
[[File:Bom audiacty_build_xcodebuild_open.png|780px]]
[[File:Bom audiacty_build_xcodebuild_open.png|780px]]
== Building with the Xcode IDE ==
== Building within Xcode ==
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:
To build Audacity
[[Category:Mac Platform]] [[Category:For Developers]]
[[Category:Mac Platform]] [[Category:For Developers]]

Revision as of 00:59, 20 January 2013

This guide will help you establish a working development environment for Audacity on OS X Snow Leopard, Lion or Mountain Lion.

The steps detailed below are focused on getting you building Audacity as quickly and easily as possible, but you may use the environment for general development as well.

Download Xcode 3.2.6

To download Xcode, you will need to register at the Apple Developer site:


Once registered, the available downloads are located here:


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.

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

Snow Leopard users may skip this step.

NOTE: You may choose to install other versions of Xcode, but at the time this guide was written, 4.5.2 was the latest and other versions may not work as outlined here.

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, press enter and download the “Command Line Tools” dmg that corresponds to your version of OS X:

Bom tools 452 download.png

Download MacPorts

Two build utilities, cmake and pkgconfig, will need to be installed and MacPorts or Fink are the easiest way to get them. This guide will use MacPorts so you will need to make adjustments if you choose to use Fink or other source.

Download the version of MacPorts which matches your OS X version from:

Bom macports download.png

Download wxWidgets

You must download the wxMac version 2.8.12 of wxWidgets from:


Bom wxwidgets 2812 download.png

Download the "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.

Install Xcode 3.2.6

Locate the Xcode 3.2.6 dmg, xcode_3.2.6_and_ios_sdk_4.3.dmg, on your system and double click it to have Finder verify and mount it:

Bom xcode 326 mount.png

The “Xcode and iOS SDK” installer checks the version of OS X that is currently running and it will not work on any version above Snow Leopard. However, this version check can be bypassed by starting the installation from the command line.

NOTE: It is advisable to have all OS X updates applied to your system before installing Xcode 3.2.6. This is especially important for Lion users as the installation will fail.

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

open "/Volumes/Xcode and iOS SDK/Xcode and iOS SDK.mpkg"

Bom xcode 326 install.png

This will start the installation while bypassing the version check:

Bom xcode 326 installer.png

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

Bom xcode 326 custom install.png

Open the Essentials item by clicking the arrow:

Bom xcode 326 options.png

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:

Bom xcode 326 selected options.png

Continue through the pages to start the installation and close the installer when complete:

Bom xcode 326 complete.png

This completes the Xcode 3.2.6 installation.

Install Xcode 4.5.2

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:

Bom xcode 452 mount.png

The Xcode folder will open when it's mounted:

Bom xcode 452 folder.png

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

Bom xcode 452 copy.png

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

Bom tools 452 mount.png

The Command Line Tools folder will open:

Bom tools 452 folder.png

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

Bom tools 452 installer.png

Once the installation completes, close the installer:

Bom tools 452 complete.png

Open a Terminal window and enter:

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

Bom xcode 452 switch.png

You will be asked to enter your password:

Bom xcode 452 switched.png

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

Bom xcode 452 xcodebuild3.png

This completes the Xcode 4.5.2 installation.

Install MacPorts

Locate the MacPorts installer and double click to start the installation:

Bom macports installer.png

Click through the installation pages and close the installer when installation completes:

Bom macports installer complete.png

Open a Terminal window and install the cmake and pkgconfig packages:

sudo port install cmake pkgconfig

Bom macports packages install.png

You will be prompted to enter your password:

Bom macports packages password.png

The packages will be downloaded and installed:

Bom macports packages complete.png

Add links to Xcode 3.2.6 so cmake and pkg-config can be located:

ln -s /opt/local/bin/cmake /Developer/usr/bin/cmake
ln -s /opt/local/bin/pkg-config /Developer/usr/bin/pkg-config

Bom macports packages link.png

This completes the MacPorts installation.

Install wxWidgets

Open a Terminal window and extract the wxWidgets source:

tar xf ~/Downloads/wxMac-2.8.12.tar

Bom wxwidgets 2812 extract.png

Change to the newly created directory:

cd wxMac-2.8.12

Bom wxwidgets 2812 cd.png

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

sh ~/Downloads/build_wxwidgets

Bom wxwidgets 2812 build.png

After all configurations are built, you will be prompted for your password:

Bom wxwidgets 2812 install.png

All configurations have been built and installed:

Bom wxwidgets 2812 complete.png

To verify, list the installed configurations:

Bom wxwidgets 2812 list.png

Make sure you see 1 default configuration and 3 alternates:

Bom wxwidgets 2812 installed.png

wxWidgets installation is now complete.

Downloading 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 source for the current stable version of Audacity or if you want to get the absolute latest development source. Remember that the latter may not build (usually does) due to active development.

Make your choice when downloading from here:


Bom audiacty build download.png

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 4 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.

Building 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:

cd audacity/mac
xcodebuild3 -configuration "Debug Static"

Bom audiacty build xcodebuild.png

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

Bom audiacty build xcodebuild complete.png

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

open "build/Debug Static/Audacity.app"

Bom audiacty build xcodebuild open.png

Building within Xcode

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: