Difference between revisions of "Building On Mac"

From Audacity Wiki
Jump to: navigation, search
(Corrected build.txt link.)
(Updated instructions (with get_gitident added))
Line 1: Line 1:
{{alert|This page is now historical. Please use Mac/Build.txt in our [https://github.com/audacity/audacity/blob/master/mac/Build.txt source code].}}
 
{{Intro|This guide will help you establish a working development environment then build a Universal Binary of Audacity on OS X Leopard, Snow Leopard, Lion or Mountain Lion.<p>The steps also work on Mavericks updated from earlier OS X but may not work on Mavericks installed as first operating system.</p>|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.}}
 
{{advice|1=
 
<ul><li> Xcode 4 (steps 2 and 7) is not required on Leopard and Snow Leopard. Xcode 4 is strongly recommended on Lion or later (it is required on those systems for [http://en.wikipedia.org/wiki/MacPorts MacPorts], [http://en.wikipedia.org/wiki/Fink Fink] and almost any other package management or development-related product).
 
<li> These steps do not apply patches required to produce a build of Audacity for public release. See [[Release Process/Mac|Release Process/Mac]] for details.</ul>}}
 
  
== Download Xcode 3.x ==
+
== Instructions in mac/build.txt ==
  
To download Xcode, you will need to register at the Apple Developer site:
 
  
:http://developer.apple.com
+
{{ednote|'''Gale 11Dec16:" Just adding here that Xcode 8.1 requires minimum of OS X 10.11.5.}}
  
Once registered, the available downloads are located here:
 
  
:http://developer.apple.com/downloads
+
These instructions for building on mac are in mac/build in the Git repo.
  
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.
+
At this time, the newest SDK version that Audacity can build with is 10.6.
 +
To build Audacity using Xcode 5.1 or newer, you need to extract the 10.6 SDK
 +
from an earlier version of Xcode.
  
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:
+
In the instructions below, Xcode 4.3.3 (for the 10.6 SDK) and Xcode 8.1 will
 +
be used. Fuller instructions that cover
 +
    * Using other xcodes
 +
    * Optional signing of DMGs
 +
    * Applying wxWidgets patches one by one
 +
can be found on our wiki at http://wiki.audacityteam.org/wiki/Building_On_Mac
 +
 +
1) Download Xcode 8.1 and install it to /Applications.
 +
2) Download Xcode 4.3.3 (it includes the 10.6 and 10.7 SDK's despite
 +
    the downloads page says it only has the 10.7 SDK).
 +
3) Open the DMG in Finder.
 +
4) Right-click the "Xcode.app" bundle and select "Show Package Contents".
 +
5) Navigate down the directories to get to:
 +
 +
    Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ .
 +
 +
6) Copy the MacOSX10.6.sdk folder to:
 +
 +
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
 +
 +
7) Change the MinimumSDKVersion key value in
 +
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist
 +
    to 10.6
 +
 +
    Xcode is now ready.
 +
 +
8) Download audacity patched wxWidgets 3.0.2 zip from the audacity copy of the
 +
    wxWidgets project:
 +
      https://github.com/audacity/wxWidgets/tree/audacity-fixes
 +
 +
    it's the green "clone or download" button on the right.
 +
 +
    Don't be tempted to use Widgets already installed by a package manager such
 +
    as Homebrew because this will cause problems.             
 +
 +
9) Once the download is complete, unzip it:
 +
 +
    unzip wxWidgets-audacity-fixes.zip
 +
 +
10) And finally build/install wxWidgets:
 +
 +
    sudo <path to Audacity source>/mac/build_wxwidgets .
 +
 +
You should now be able to build Audacity using either the Xcode application or
 +
the Xcodebuild command line tool.
 +
 +
* Using xcodebuild, build Audacity and create DMG and ZIP bundles in
 +
  /private/tmp by typing the following in the terminal:
 +
 +
  xcodebuild -configuration Release install 
 +
 +
* If you use the Xcode application, don't make any changes to
 +
  Audacity.xcodeproj recommended by Xcode. In particular, be sure to leave the
 +
  Base SDK configuration set to 10.6 as it is now.
 +
 +
If you need Audacity to show languages other than English, install the gettext
 +
suite of tools (to get the msgfmt command).  The source can be downloaded from:
 +
 +
    ftp://ftp.gnu.org/gnu/gettext/gettext-latest.tar.gz
 +
 +
Untar it:
 +
 +
    tar xf gettext-latest.tar.gz
 +
 +
And install:
 +
 +
    cd gexttext-latest
 +
    ./configure
 +
    sudo make install
  
:[[File:Bom xcode 326 download.png|780px]]
 
  
== Download Xcode 4.5.2 ==
+
==More Detailed Wiki Instructions ==
{{note|
 
* Tiger, Leopard and Snow Leopard users should skip this step.
 
* On Lion or Mountain Lion you may install any 4.x version of Xcode greater than 4.3.x (or on Mountain Lion 10.8.4 or greater you may install Xcode 5.x) but at the time this guide was written 4.5.2 was the latest and other versions may not work as outlined here.}}
 
{{advice|If you get Audacity building following the steps in this article then upgrade to Mavericks, you '''must''' install Xcode 5.0 or greater in order to continue building Audacity. Note that installing Xcode 5.x from the App Store will remove Xcode 4.x.}} 
 
Enter “Xcode 4.5.2” in the search box on the left, press enter, and download the “Xcode 4.5.2” dmg:
 
  
:[[File:Bom xcode 452 download.png|780px]]
+
These instructions for variations on building aren't in mac/build in the Git repo.
  
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:
 
  
:[[File:Bom tools 452 download.png|780px]]
+
===Using wxWidgets from wxWidgets===
  
== Download wxWidgets ==
+
Rather than downloading patched wxWidgets, you can download 3.0.2 and patch it yourself
  
You must download the wxMac version 2.8.12 of wxWidgets from:
+
  Apply the following fixes to wxWidgets:
 +
 +
  cd wxWidgets-3.0.2
 +
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-fixes.patch .
 +
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/eventloops.patch .
 +
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/pinch-spread.patch .
 +
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/focusrings.patch .
 +
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-wxaccessible.patch .
 +
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/tooldock-quit.patch .
 +
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/fullscreen.patch .
  
:http://www.wxwidgets.org/downloads/
 
  
[[File:Bom wxwidgets 2812 download.png|780px]]
+
===Updating GitIdent===
  
Download the "[[Media:Build wxwidgets.gz|Build wxwidgets.gz]]" script that will be used to build wxWidgets for use with AudacityMake sure you save the file as "Build_wxwidgets.gz". Safari will automatically uncompress the file, others may not.
+
The Audacity about box can contain a link to the corresponding git commit
 +
To create this, run the batch script:
 +
 +
  get_gitident.sh
 +
 +
If you do this, you are responsible for making sure the ident is correct
 +
in future builds. The script over writes RevisionIdent.h in the src directory.
 +
  If you make further changes to your local copy after this step, or merge
 +
more recent version from git, this file, and hence the ident in the build,
 +
  stays the same, and so would be misleading.
 +
 +
To reset RevisionIdent.h you could do:
 +
 +
  git reset -hard origin/master
 +
  
 +
===Signing the DMG===
  
== Download cmake ==
+
1) Comment out the last line of mac/scripts/build_dist.sh so that it reads
 +
 +
  #rm -rf ${DMG} TMP.dmg
 +
 +
  This will prevent deletion of TMP.dmg
 +
 +
2) Clean and build Audacity normally.
 +
 +
3) Navigate to /private/tmp/ and type
 +
 +
    hdiutil resize -size 200m TMP.dmg
 +
 +
    This step is needed as codesigning takes some temporary space, more than is
 +
    available in the dmg.
 +
 +
4) mount the dmg
 +
    hdiutil mount TMP.dmg
 +
 +
5) Codesign the app (deep to make sure everything important is signed)
 +
   
 +
    codesign --deep -s <identity> -v "/Volumes/Audacity 2.1.3/Audacity/Audacity.app"
 +
 +
6) Check it is signed to gatekeeper's satisfaction:
 +
 +
    spctl -a -v "/Volumes/Audacity 2.1.3/Audacity/Audacity.app"
 +
 +
7) unmount the dmg
 +
 +
8) Make a compressed dmg
 +
 +
    hdiutil convert TMP.dmg -format UDZO -imagekey zlib-level=9 -o "Newname.dmg"
 +
 +
9) codesign that
 +
 +
    codesign -s <identity> -v Newname.dmg
 +
  
Download the latest Unix/Linux source version of cmake from:
+
To test the signing, upload the dmg to dropbox and then download it again.  Then double click to
 +
install and drag across to apps.  When you go to run, you now get a warning about having downloaded form the
 +
internet, rather than being prevented from running...
  
:http://www.cmake.org/cmake/resources/software.html
 
 
[[File:Bom cmake download.png|780px]]
 
 
 
== Download pkg-config ==
 
 
Download the latest version of pkg-config from:
 
 
:http://pkgconfig.freedesktop.org/releases/
 
 
[[File:Bom pkg-config download.png|780px]]
 
 
 
== 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:
 
 
[[File:Bom xcode 326 mount.png|center|480px]]
 
 
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.
 
{{note|It is advisable to have all OS X updates applied to your system before installing Xcode 3.x.  This is especially important for Lion users otherwise the installation will fail.}}
 
{{advice|On Lion and Mountain Lion, the "Security & Privacy" section of System Preferences must be temporarily set to allow applications downloaded from "Anywhere", or Gatekeeper will prevent the package being opened.}} 
 
 
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"
 
 
[[File:Bom xcode 326 install.png|780px]]
 
 
This will start the installation while bypassing the version check.
 
 
On Mountain Lion, the installer needs to restart itself:
 
 
[[File:Bom xcode 326 restart.png|780px]]
 
 
And, since the Xcode 3.2.6 certificate has expired, you will be asked to accept it:
 
 
[[File:Bom xcode 326 cert.png|780px]]
 
 
You will then get to the normal installation process:
 
 
[[File:Bom xcode 326 installer.png|780px]]
 
 
Proceed through the various installation pages until you get to the “Custom Install” page:
 
 
[[File:Bom xcode 326 custom install.png|780px]]
 
 
Open the Essentials item by clicking the arrow:
 
 
[[File:Bom xcode 326 options.png|780px]]
 
 
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:
 
 
[[File:Bom xcode 326 selected options.png|780px]]
 
 
Continue through the pages to start the installation.
 
 
On Mountain Lion, you will be prompted to stop iTunes near the end of the installation:
 
 
[[File:Bom xcode 326 itunes.png|center|480px]]
 
 
To terminate the process and allow the installation to complete, open a Terminal window and enter:
 
 
:sudo killall iTunesHelper
 
[[File:Bom xcode 326 ituneshelper.png|780px]]
 
 
Close the installer when complete:
 
 
[[File:Bom xcode 326 complete.png|780px]]
 
 
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:
 
 
[[File:Bom audiacty_build_xcode_goto.png|center|480px]]
 
 
Enter "/Developer/Applications" for the path and click "Go":
 
 
[[File:Bom audiacty_build_xcode_folder.png|780px]]
 
 
Now double-click the "Xcode" application to start it:
 
 
[[File:Bom audiacty_build_xcode_start.png|780px]]
 
 
At this point you may prompted to install Java:
 
 
[[File:Bom audiacty_build_xcode_java.png|center|480px]]
 
 
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:
 
 
[[File:Bom xcode 452 mount.png|center|480px]]
 
 
The Xcode folder will open when it's mounted:
 
 
[[File:Bom xcode 452 folder.png|780px]]
 
 
You may choose to drag the Xcode app to wherever you like, but this guide expects it to be located in the Applications folder:
 
 
[[File:Bom xcode 452 copy.png|780px]]
 
 
Locate the Command Line Tools dmg, xcode452cltools10_76938212a.dmg, on your system and double click it to have Finder verify and mount it:
 
 
[[File:Bom tools 452 mount.png|center|480px]]
 
 
The Command Line Tools folder will open:
 
 
[[File:Bom tools 452 folder.png|780px]]
 
 
Start the installation by double clicking the installer, “Command Line Tools (Lion).mpkg” in this case:
 
 
[[File:Bom tools 452 installer.png|780px]]
 
 
Once the installation completes, close the installer:
 
 
[[File:Bom tools 452 complete.png|780px]]
 
 
and you may eject the Command Line Tools .dmg.
 
 
In the Terminal window, enter:
 
 
:sudo xcode-select -switch "/Applications/Xcode.app/Contents/Developer"
 
 
[[File:Bom xcode 452 switch.png|780px]]
 
 
You will be asked to enter your password:
 
 
[[File:Bom xcode 452 switched.png|780px]]
 
 
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
 
 
[[File:Bom xcode 452 xcodebuild3.png|780px]]
 
 
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
 
 
[[File:Bom cmake configure.png|780px]]
 
 
Build cmake:
 
 
:make
 
 
[[File:Bom cmake build.png|780px]]
 
 
Install cmake:
 
 
:sudo make install
 
 
[[File:Bom cmake install.png|780px]]
 
 
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
 
 
[[File:Bom pkgconfig extract.png|780px]]
 
 
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
 
 
[[File:Bom pkgconfig configure.png|780px]]
 
 
and build pkg-config:
 
 
:make
 
 
[[File:Bom pkgconfig build.png|780px]]
 
 
Install pkg-config:
 
 
:sudo make install
 
 
[[File:Bom pkgconfig install.png|780px]]
 
 
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
 
 
[[File:Bom wxwidgets 2812 extract.png|780px]]
 
 
Change to the extracted directory:
 
 
:cd wxMac-2.8.12
 
 
:or:
 
 
:cd ~/Downloads/wxMac-2.8.12
 
 
[[File:Bom wxwidgets 2812 cd.png|780px]]
 
 
Start the build.  This assumes you downloaded the Build_wxwidgets script to your Downloads directory:
 
 
:sh ~/Downloads/Build_wxwidgets
 
 
[[File:Bom wxwidgets 2812 build.png|780px]]
 
 
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:
 
 
[[File:Bom wxwidgets 2812 install.png|780px]]
 
 
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
 
 
[[File:Bom wxwidgets 2812 complete.png|780px]]
 
 
To verify, list the installed configurations:
 
 
:wx-config --list
 
[[File:Bom wxwidgets 2812 list.png|780px]]
 
 
Make sure you see 1 default configuration (mac-unicode-release-2.8)
 
and 3 alternates:
 
 
[[File:Bom wxwidgets 2812 installed.png|780px]]
 
 
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
 
 
[[File:Bom create links.png|780px]]
 
 
 
== 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).
 
{{advice|Remember that occasionally, SVN HEAD may not build becaue of development in progress, or if it does, there may be bugs.}}
 
 
Make your choice when downloading from here:
 
 
:http://audacityteam.org/download/source
 
 
[[File:Bom audiacty_build_download.png|780px]]
 
 
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"
 
 
[[File:Bom audiacty_build_xcodebuild.png|780px]]
 
 
When it completes, you should get a "Build Succeeded" message:
 
 
[[File:Bom audiacty_build_xcodebuild_complete.png|780px]]
 
 
The newly built Audacity can be started from Finder, using gdb, or simply:
 
 
:open "build/Debug Static/Audacity.app"
 
 
[[File:Bom audiacty_build_xcodebuild_open.png|780px]]
 
 
 
== 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:
 
 
[[File:Bom audiacty_build_xcode_goto.png|center|480px]]
 
 
Enter "/Developer/Applications" for the path and click "Go":
 
 
[[File:Bom audiacty_build_xcode_folder.png|780px]]
 
 
Now double-click the "Xcode" application to start it:
 
 
[[File:Bom audiacty_build_xcode_start.png|780px]]
 
 
Open the Audacity Xcode project by selecting "Open" from the "File" menu in Xcode:
 
 
[[File:Bom audiacty_build_xcode_open.png|center|480px]]
 
 
Navigate to the "audacity/mac" folder and then double-click the "Audacity.xcodeproj" project:
 
 
[[File:Bom audiacty_build_xcode_xcodeproj.png|780px]]
 
 
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.
 
{{note|If you have installed Xcode 5.x there will be a warning in the Xcode status bar when Xcode runs Audacity:<p>'''GDB: Data Formatters temporarily unavailable, will re-try after a 'continue'.'''</p> To workaround this, just choose "Continue" from the "Run" menu.}}
 
 
[[File:Bom audiacty_build_xcode_build.png|780px]]
 
  
 
[[Category:Mac Platform]] [[Category:For Developers]]
 
[[Category:Mac Platform]] [[Category:For Developers]]

Revision as of 11:53, 27 December 2016

Instructions in mac/build.txt

Gale 11Dec16:" Just adding here that Xcode 8.1 requires minimum of OS X 10.11.5.


These instructions for building on mac are in mac/build in the Git repo.


At this time, the newest SDK version that Audacity can build with is 10.6. 
To build Audacity using Xcode 5.1 or newer, you need to extract the 10.6 SDK
from an earlier version of Xcode.
In the instructions below, Xcode 4.3.3 (for the 10.6 SDK) and Xcode 8.1 will
be used.  Fuller instructions that cover 
   * Using other xcodes
   * Optional signing of DMGs
   * Applying wxWidgets patches one by one
can be found on our wiki at http://wiki.audacityteam.org/wiki/Building_On_Mac

1) Download Xcode 8.1 and install it to /Applications.
2) Download Xcode 4.3.3 (it includes the 10.6 and 10.7 SDK's despite 
   the downloads page says it only has the 10.7 SDK).
3) Open the DMG in Finder.
4) Right-click the "Xcode.app" bundle and select "Show Package Contents".
5) Navigate down the directories to get to:

   Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ .

6) Copy the MacOSX10.6.sdk folder to:

   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

7) Change the MinimumSDKVersion key value in 
   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist 
   to 10.6

   Xcode is now ready.

8) Download audacity patched wxWidgets 3.0.2 zip from the audacity copy of the 
   wxWidgets project: 
      https://github.com/audacity/wxWidgets/tree/audacity-fixes

   it's the green "clone or download" button on the right.

   Don't be tempted to use Widgets already installed by a package manager such 
   as Homebrew because this will cause problems.              

9) Once the download is complete, unzip it:

   unzip wxWidgets-audacity-fixes.zip

10) And finally build/install wxWidgets:

   sudo <path to Audacity source>/mac/build_wxwidgets .

You should now be able to build Audacity using either the Xcode application or 
the Xcodebuild command line tool. 

* Using xcodebuild, build Audacity and create DMG and ZIP bundles in 
  /private/tmp by typing the following in the terminal:

  xcodebuild -configuration Release install   

* If you use the Xcode application, don't make any changes to 
  Audacity.xcodeproj recommended by Xcode. In particular, be sure to leave the
  Base SDK configuration set to 10.6 as it is now. 

If you need Audacity to show languages other than English, install the gettext
suite of tools (to get the msgfmt command).  The source can be downloaded from:

   ftp://ftp.gnu.org/gnu/gettext/gettext-latest.tar.gz

Untar it:

   tar xf gettext-latest.tar.gz

And install:

   cd gexttext-latest
   ./configure
   sudo make install


More Detailed Wiki Instructions

These instructions for variations on building aren't in mac/build in the Git repo.


Using wxWidgets from wxWidgets

Rather than downloading patched wxWidgets, you can download 3.0.2 and patch it yourself

 Apply the following fixes to wxWidgets:

  cd wxWidgets-3.0.2
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-fixes.patch .
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/eventloops.patch .
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/pinch-spread.patch .
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/focusrings.patch .
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-wxaccessible.patch .
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/tooldock-quit.patch .
  patch -p0 -i <path to Audacity source>/mac/wxMac_additions/fullscreen.patch .


Updating GitIdent

The Audacity about box can contain a link to the corresponding git commit 
To create this, run the batch script:

  get_gitident.sh

If you do this, you are responsible for making sure the ident is correct
in future builds.  The script over writes RevisionIdent.h in the src directory.
If you make further changes to your local copy after this step, or merge 
more recent version from git, this file, and hence the ident in the build, 
stays the same, and so would be misleading.

To reset RevisionIdent.h you could do:

  git reset -hard origin/master

Signing the DMG

1) Comment out the last line of mac/scripts/build_dist.sh so that it reads

  #rm -rf ${DMG} TMP.dmg

  This will prevent deletion of TMP.dmg

2) Clean and build Audacity normally.

3) Navigate to /private/tmp/ and type 

   hdiutil resize -size 200m TMP.dmg

   This step is needed as codesigning takes some temporary space, more than is 
   available in the dmg.

4) mount the dmg
   hdiutil mount TMP.dmg

5) Codesign the app (deep to make sure everything important is signed)
    
   codesign --deep -s <identity> -v "/Volumes/Audacity 2.1.3/Audacity/Audacity.app"

6) Check it is signed to gatekeeper's satisfaction:

   spctl -a -v "/Volumes/Audacity 2.1.3/Audacity/Audacity.app"

7) unmount the dmg

8) Make a compressed dmg

   hdiutil convert TMP.dmg -format UDZO -imagekey zlib-level=9 -o "Newname.dmg"

9) codesign that

   codesign -s <identity> -v Newname.dmg

To test the signing, upload the dmg to dropbox and then download it again. Then double click to install and drag across to apps. When you go to run, you now get a warning about having downloaded form the internet, rather than being prevented from running...