Developing On Mac

From Audacity Wiki
Revision as of 16:54, 7 October 2009 by Mchinen (talk | contribs) (adding reminder to patch wxMac before building)
Jump to: navigation, search

Related Pages:

Compiling on Mac OS X


While the 1.3.4 code will build, it will crash due to problems in AudioIO.cpp. Build from the latest CVS development code  instead, where this problem is fixed.

Read the instructions in "compile.txt" in the "Mac" subdirectory of the source tree. Compile at the command-line, or use the Xcode project file. The latest Xcode project file in CVS is OK. The one tagged as "1_3_4" in CVS is rather broken and is missing a few source files and the whole of libvamp.

Compile just as you would a Unix program (see here). After building "audacity", an additional step is performed, that creates "". Make sure that you run "" and not "audacity", otherwise it won't work.


wxMac is the version of wxWidgets for Mac OS.

  • Audacity 1.2.x / wxWidgets 2.4 ONLY: In the "mac" directory there is a patch file for wxMac-2.4.0 - it's recommended that you apply this patch first. This enables support for custom cursors, allows disabling anti-aliased text (for speed), and fixes a couple of bugs.
  • Audacity 1.3.0 through 1.3.5 / wxWidgets 2.6 ONLY: These beta builds used wxWidgets 2.6 and will only build using 2.6.
  • Audacity 1.3.6 or greater / wxWidgets 2.8.9 or greater: There were 2 significant bug fixes in wxWidgets 2.8.9 upon which Audacity versions starting with 1.3.6 depend.

Latest position building from CVS HEAD

Generally it seems easier to build a native PPC or Intel version than a Universal Binary. This scenario is reported to build from CVS HEAD as a Universal Binary on both Power PC and Intel Mac on OS X 10.5.1, using Xcode 3 and either wxWidgets 2.6.4 or 2.8.10, or the OS X 10.5.1 wxWidgets shared library. The general principles are:

  1. Create a wx directory in your audacity directory. For example: $HOME/audacity/wx
  2. Patch the wxMac2.8.10 bz doing the following
cd /path/to/wxMac-2.8.10

patch -p1 < /path/to/audacityrepos/mac/wxMac-2.8.10.patch

  1. Build wxWidgets from the command line. Make a build directory inside the wxWidgets directory and from there run (without the line breaks):
../configure --disable-shared --enable-universal_binary
--prefix=/path/to/audacity-beta/wx/ --enable-static --enable-unicode 
--disable-dependency-tracking --disable-monolithic

For wxWidgets 2.6.x:
  1. add --with-expat=builtin  to the above
  2. in utils/wxrc/Makefile add -mmacosx-version-min=10.4  to the CXX = g++ line (25)
  3. change the #define of ICONV_CHAR_CAST in src/common/strconv.cpp to:
    #define ICONV_CHAR_CAST(x) ((const char **)(x))

2. Do make followed by make install.
3. Open the audacity.xcodeproj file. You should create a text file called Debug_Static.xcconfig in the same directory as the project file, and add the line to this text file to include the path you specified as --prefix when building wxMac. For example 'WXPREFIX = /path/to/audacity/wx'.
3.5. If you get an error saying that pkg-config is required, you need to add the path of pkg-config on your system to the XCode settings by adding the line 'PATH = /sw/bin:$PATH' to the .xcconfig file (in the project's XCode settings folder. It may also be in /opt/bin if you use macports vs fink.
4. Compile Audacity 1.3.4 using Xcode. Open the latest Xcode project file and update it if required. In the list of targets do a "Get Info" on Audacity and Configure. You may need to change a few "User-Defined" settings. Most of the Wx ones need changing to which version of wxWidgets you've chosen and the path that you set above in --prefix when building it. You may have to change the CONFIG_STATIC and CONFIG_UNICODE in Configure. Most of the settings required for these variables can be gained from running wx-config --libs, --ld or --cflags.

If further problems are encountered: please view this thread  on the Audacity Forum  or email the Audacity developer list:
(audacity-devel _AT_ lists_DOT_sourceforge_DOT_net) or click here .

Update (27 Jan 08): A script  is now available that builds a Universal Binary version of Audacity from CVS. Currently the build requires Mac OS X 10.4. If you were using an earlier version of the script, please update using the above link. The earlier version may accidentally link to system libraries in error. The script starts with a wxMac-2.6.4 tarball and downloads a fresh copy of Audacity from scratch from CVS, compiles both targets separately and then merges them into the universal binary, finally making the disk image.

Update (1 Nov 08): The above script is broken when using audacity head from cvs. The head of audacity cvs is now built using wx 2.8.10.