Difference between revisions of "Building On Mac"

From Audacity Wiki
Jump to: navigation, search
(Missing spaces.)
m (+deprecated)
 
(42 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 +
{{deprecated|https://github.com/audacity/audacity/blob/master/BUILDING.md}}
 +
{{ednote|1=[[ToDo-2]] Add<br>
 +
* Instructions for building modules
 +
}}{{Intro|1='''These are instructions for building on Mac'''
 +
 +
The build family of pages:
 +
* [[Building On Windows]]
 +
* [[Building On Mac]]
 +
* [[Building On Linux]]}}
  
 
== Instructions in mac/build.txt ==
 
== Instructions in mac/build.txt ==
  
 +
{{note|1=These instructions for building on mac are in [https://github.com/audacity/audacity/blob/master/mac/cmake_build.txt mac/cmake_build.txt in the Git repo].}}
 +
 +
<pre>
 +
Instructions for building on macOS using CMake.
 +
 +
Building on macOS has been made much simpler with the Audacity 2.4.0
 +
release. Still, read this document throughly before starting.
 +
 +
1) Get and install the latest Xcode version available your macOS version:
 +
 +
      MacOS                  Xcode Version (as of Mar 2020)
 +
      Catalina - 10.15        11.3
 +
      Mojave - 10.14          10.3
 +
      High Sierra - 10.13    9.4.1
 +
      Sierra - 10.12          9.2
 +
      El Capitan - 10.11      8.2.1
 +
      Yosemite - 10.10        7.2.1
 +
 +
2) Clone the Audacity repository:
 +
 +
      git clone https://github.com/audacity/audacity
 +
 +
3) Clone wxWidgets 3.1.3:
 +
 +
      git clone --recurse-submodules https://github.com/audacity/wxWidgets.git
 +
 +
  Ensure that you clone with the "--recurse-submodules" option, and do not
 +
  just download the Zip package, otherwise there will be required components
 +
  missing.
 +
 +
  Don't be tempted to use wxWidgets already installed by a package manager
 +
  such as Homebrew because this will cause problems.
 +
 +
  We have applied some Audacity specific patches to wxWidgets to better
 +
  support VoiceOver, so please use the audacity-fixes-3.1.3 branch. It's
 +
  the default branch on our GitHub copy:
 +
 +
      https://github.com/audacity/wxWidgets/tree/audacity-fixes-3.1.3
 +
 +
  You can be certain the correct branch is active with:
 +
 +
      git checkout audacity-fixes-3.1.3
 +
 +
4) Change directory to the folder where wxWidgets was cloned and build it using:
 +
 +
      sudo <path to Audacity source>/mac/scripts/build_wxwidgets
 +
 +
5) The config command should return "3.1.3" if the install was successful:
 +
 +
      /usr/local/x86_64/bin/wx-config --version
 +
 +
6) Now that you have wxWidgets installed, edit your ~/.bash_profile or
 +
  ~/.zprofile and add:
 +
 +
      export WX_CONFIG=/usr/local/x86_64/bin/wx-config
 +
 +
  Log out and back in again (or reboot) for this to take effect.
 +
 +
7) Download the CMake 3.16.4 DMG from:
 +
 +
      https://cmake.org/download
 +
 +
8) Double click the DMG, follow the prompts and drag the CMake app to the
 +
  Applications folder.
 +
 +
  If you will be building from the command line, open the CMake application
 +
  and click the "Tools -> How to Install For Command Line Use" menu. It will
 +
  give you additional instructions on making CMake available to the command
 +
  line.
 +
 +
  You are now ready to start building Audacity.
 +
 +
BUILDING USING THE CMAKE GUI
 +
 +
  NOTE: Building with the GUI interface will result in the downloading of
 +
        another copy of wxWidgets from Audacity.
 +
 +
1) Open the app.
 +
 +
2) Click the "Browse Source..." button and locate the top of your Audacity
 +
  source tree, then click the "Open" button.
 +
 +
3) Click the "Browse Build..." button and find the location where you want to
 +
  put the build (use the "New Folder" button at the bottom left to create a
 +
  new folder).
 +
 +
  This folder does not have to be in or even near the source tree, but it
 +
  must not be the same as the source tree. However, it is common to make it
 +
  a subdirectory of the Audacity source tree.
 +
 +
4) Click the "Configure" button and when the dialog pops up, select "Xcode" for
 +
  the generator, then click the "Done" button.
 +
 +
5) Click the "Generate" button to create the Xcode project.
 +
 +
6) Now you can either click the "Open Project" button or go to your "Build" folder in
 +
  Finder and open the Xcode project as normal.
 +
 +
BUILDING FROM THE COMMAND LINE
 +
 +
1) Change directory to your Audacity source tree.
 +
 +
      cd audacity
 +
 +
2) Create the "build" folder (name it anything you like):
 +
 +
      mkdir bld
 +
 +
3) Change to the "build" folder:
 +
 +
      cd bld
 +
 +
4) Configure and generate the Xcode project:
 +
 +
      cmake -G Xcode ..
  
{{ednote|'''Gale 11Dec16:''' Just adding here that Xcode 8.1 requires minimum of OS X 10.11.5.}}
+
5) Build Audacity using the CMake command or xcodebuild:
  
These instructions for building on mac are in mac/build.txt in the Git repo.
+
      cmake --build . --config Release
  
At this time, the newest SDK version that Audacity can build with is 10.6.  
+
      xcodebuild --configuration Release
To build Audacity using Xcode 5.1 or newer, you need to extract the 10.6 SDK
+
 
  from an earlier version of Xcode.
+
  The "Audacity.app" bundle will be in the "bin/Release" subdirectory of your
 +
  "build" folder, so you can start it via Finder or:
 +
 
 +
      open bin/Release/Audacity.app
 +
 
 +
Notes:
 +
 
 +
  - If you'd like to get a completely clean build, just delete "build" folder
 +
    and return to step 2 above.
 +
 
 +
  - Once the Xcode project is generated, you shouldn't have to "configure" or
 +
    "generate" again as it will be done for you automatically after pulling
 +
    updates and building.
 +
 
 +
    For example:
 +
 
 +
        cd <audacity> directory
 +
        git pull
 +
        cd bld
 +
        cmake --build . --config Release
 +
 
 +
  - Instructions on optional signing of DMGs, showing languages other than English,
 +
    and other useful information can be found on our wiki at:
 +
    http://wiki.audacityteam.org/wiki/Building_On_Mac
 +
 
 +
</pre>
 +
 
 +
== CMake Build ==
 +
 
 +
<pre>
 +
1) Change directory to your Audacity source tree.
 +
 
 +
      cd audacity
 +
 
 +
2) Create the "build" folder (name it anything you like):
 +
 
 +
      mkdir bld
 +
 
 +
3) Change to the "build" folder:
 +
 
 +
      cd bld
 +
 
 +
4) Configure and generate the Xcode project:
 +
 
 +
      cmake -G Xcode ..
 +
 
 +
5) Build Audacity using the CMake command or xcodebuild:
 +
 
 +
      cmake --build . --config Release
 +
 
 +
      xcodebuild --configuration Release
 +
 
 +
  The "Audacity.app" bundle will be in the "bin/Release" subdirectory of your
 +
  "build" folder, so you can start it via Finder or:
 +
 
 +
      open bin/Release/Audacity.app
 +
</pre>
 +
 
 +
== For a Release CMake build ==
 +
 
 +
Additionally:
 +
 
 +
<pre>
 +
6) Add the help files
 +
 
 +
  Open contents of bin/Release/Audacity.app
 +
  Add in files with directory help/manual/ and then the 5 top level items
 +
 
 +
7) Notarize Audacity
 +
 
 +
  ../mac/scripts/build_dist.sh ../mac ../bld/bin/Release
 +
</pre>
 +
 
 +
For Notarization to work, you'll need to have already jumped through the Apple hoops, and have set up your signing file.  There are two stages to notarization, one for the bundle, one for the dmg.
 +
 
 +
To test the Notarization, upload the dmg to dropbox and then download it again. Then double-click to
 +
install and drag across to /Applications. When you launch Audacity, you now get a warning about having downloaded from the internet, rather than being prevented from running...
 +
 
 +
 
 +
== Optional Extras ==
 +
 
 +
{{tip|'''FFmpeg and LAME'''
 +
For these, see [[Building Extras on Mac]]}}
 +
 
 +
== Variations ==
 +
 
 +
{{note|1=These instructions for variations on building aren't in mac/build.txt in the Git repo.  They're actually mostly obsolete instructions.  The CMake building now takes care of the GitIdent and mod-script-pipe.  Languages should not be an issue if you are already set up with gettext.  The signing has been replaced by Notarization.  We no longer declutter the dmg, and no one has complained or commented about it on the forums.}}
 +
 
 +
===Fetching The Manual===
 +
 
 +
We have [[Building The Manual|instructions for fetching the manual]] on another page.
  
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.
 
 
* Change directory to <path to Audacity source>/mac
 
  Optionally, if you have built before, clean with:
 
 
  xcodebuild clean
 
 
* 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
 
  
 +
===Defaulting to Portable Settings===
  
==More Detailed Wiki Instructions ==
+
<pre>
 +
1. Within audacity.app/Contents add the directories:
 +
    Portable Settings
 +
    Portable Settings/AutoSave
  
These instructions for variations on building aren't in mac/build.txt in the Git repo.
+
2. Set permissions on these two directories to 777
 +
    chmod 777 "Portable Settings"
 +
    chmod 777 "Portable Settings/AutoSave"
 +
</pre>
  
===Using wxWidgets from wxWidgets===
+
These steps should of course be done before signing.
  
Rather than downloading patched wxWidgets, you can download 3.0.2 and patch it yourself
+
== Official Full Releases==
  
  Apply the following fixes to wxWidgets:
+
Official Audacity full releases:
 
  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 .
 
  
The patches and their reasons can be found [https://github.com/audacity/wxWidgets/commits/audacity-fixes here], and there is more description about them [[For_Upstream_wxWidgets|here]] in the wiki.
+
* Have a GitIdent, visible in the about box build information, that says what branch was used in building.
 +
* Include a copy of the manual.
 +
* Include other languages.
 +
* Have a de-cluttered .dmg (the folders in it are dragged outside the visible area)
 +
* Are signed with a signing key.
  
 +
<s>
 
===Updating GitIdent===
 
===Updating GitIdent===
  
  The Audacity about box can contain a link to the corresponding git commit  
+
<pre>
  To create this, run the batch script:
+
  The Audacity "About" box can contain a link to the git commit at which
 +
  Audacity was built. To create this, run this batch script in /mac/scripts/
 
   
 
   
 
   get_gitident.sh
 
   get_gitident.sh
 
   
 
   
 
  If you do this, you are responsible for making sure the ident is correct
 
  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.
+
  in future builds.  The script overwrites RevisionIdent.h in the src directory.
  If you make further changes to your local copy after this step, or merge  
+
  If you make further changes to your local copy after this step, or merge a
 
  more recent version from git, this file, and hence the ident in the build,  
 
  more recent version from git, this file, and hence the ident in the build,  
 
  stays the same, and so would be misleading.
 
  stays the same, and so would be misleading.
Line 123: Line 267:
 
  To reset RevisionIdent.h you could do:
 
  To reset RevisionIdent.h you could do:
 
   
 
   
   git reset -hard origin/master
+
   git reset --hard origin/master
   
+
</pre>
 +
 
 +
===Include mod-script-pipe===
 +
 
 +
Build this within the Xcode project ON THE SAME DAY as you built audacity. You can click on the .so in the IDE to find out where Xcode put it (it will have some weird long temporary path).
 +
 
 +
Just before code signing, add it in to the Audacity bundle, into a subdirectory called 'modules'.
 +
</s>
 +
 
 +
===Include Languages===
 +
 
 +
 
 +
{{alert|1=Beware!  Audacity needs a clean and then a recompile if it is to include languages.<br>
 +
For some reason yet to be investigated, incremental compiles will not include the language files in audacity.app.<br>
 +
''(Check by looking inside the app and looking in 'Resources')''}}
 +
 
 +
<pre>
 +
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
 +
 
 +
Then clean and recompile.
 +
Incremental compiles will NOT include the language files.
 +
 
 +
</pre>
 +
 
 +
<s>
 +
===Decluttering the dmg===
 +
 
 +
<pre>
 +
1. Open the dmg
 +
 
 +
2. Drag the right border wider.
 +
 
 +
3. Drag all folders that should not be visible into that area.
 +
 
 +
4. Drag right border narrower again.
 +
</pre>
 +
 
  
 
===Signing the DMG===
 
===Signing the DMG===
  
 +
<pre>
 
  1) Comment out the last line of mac/scripts/build_dist.sh so that it reads
 
  1) Comment out the last line of mac/scripts/build_dist.sh so that it reads
 
   
 
   
Line 133: Line 327:
 
   
 
   
 
   This will prevent deletion of TMP.dmg
 
   This will prevent deletion of TMP.dmg
+
 
  2) Clean and build Audacity normally.
+
  2) Delete any previous /private/tmp/TMP.dmg and /private/tmp/Audacity.dst
 +
    (otherwise, the rebuilt plug-ins folder will contain an unnecessary duplicate
 +
    of itself).
 +
 
 +
    Then clean and build Audacity normally.
 
   
 
   
 
  3) Navigate to /private/tmp/ and type  
 
  3) Navigate to /private/tmp/ and type  
Line 145: Line 343:
 
  4) mount the dmg
 
  4) mount the dmg
 
     hdiutil mount TMP.dmg
 
     hdiutil mount TMP.dmg
 +
 +
4a) Not part of the signing, but a good idea to de-clutter the dmg
 +
    per instructions in the section above.
 
   
 
   
 
  5) Codesign the app (deep to make sure everything important is signed)
 
  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"
+
     codesign --deep -s <identity> -v "/Volumes/Audacity 2.2.0/Audacity.app"
 +
 
 +
    If you see errors like this, no matter what size you used in step (3):
 +
 
 +
        can't allocate code signature data for: /Volumes/Audacity 2.2.0/Audacity.app/Contents/MacOS/Audacity
 +
        (for architecture i386) because larger updated load commands do not fit (the program must be relinked
 +
        using a larger -headerpad value)
 +
 
 +
    Then in the XCode project, add -headerpad_max_install_names to Other Linker flags (OTHER_LDFLAGS)
 +
    for Release configuration of the Audacity target, and go back to step (2).
 
   
 
   
 
  6) Check it is signed to gatekeeper's satisfaction:
 
  6) Check it is signed to gatekeeper's satisfaction:
 
   
 
   
     spctl -a -v "/Volumes/Audacity 2.1.3/Audacity/Audacity.app"
+
     spctl -a -v "/Volumes/Audacity 2.2.0/Audacity.app"
 
   
 
   
 
  7) unmount the dmg
 
  7) unmount the dmg
 +
 +
    hdiutil eject "/Volumes/Audacity 2.2.0"
 
   
 
   
 
  8) Make a compressed dmg
 
  8) Make a compressed dmg
Line 163: Line 375:
 
   
 
   
 
     codesign -s <identity> -v Newname.dmg
 
     codesign -s <identity> -v Newname.dmg
+
</pre>
 +
</s>
  
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...
 
  
  
 
[[Category:Mac Platform]] [[Category:For Developers]]
 
[[Category:Mac Platform]] [[Category:For Developers]]

Latest revision as of 11:54, 19 August 2021

Warning icon This page has been deprecated. Newer information can be found here: https://github.com/audacity/audacity/blob/master/BUILDING.md
The information on this page are likely out-of-date and will not be updated in the forseeable future. It may be removed at any time.
ToDo-2 Add
  • Instructions for building modules
These are instructions for building on Mac

The build family of pages:

Instructions in mac/build.txt

These instructions for building on mac are in mac/cmake_build.txt in the Git repo.
Instructions for building on macOS using CMake.

Building on macOS has been made much simpler with the Audacity 2.4.0
release. Still, read this document throughly before starting.

1) Get and install the latest Xcode version available your macOS version:

      MacOS                   Xcode Version (as of Mar 2020)
      Catalina - 10.15        11.3
      Mojave - 10.14          10.3
      High Sierra - 10.13     9.4.1
      Sierra - 10.12          9.2
      El Capitan - 10.11      8.2.1
      Yosemite - 10.10        7.2.1

2) Clone the Audacity repository:

      git clone https://github.com/audacity/audacity

3) Clone wxWidgets 3.1.3:

      git clone --recurse-submodules https://github.com/audacity/wxWidgets.git

   Ensure that you clone with the "--recurse-submodules" option, and do not
   just download the Zip package, otherwise there will be required components
   missing.

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

   We have applied some Audacity specific patches to wxWidgets to better 
   support VoiceOver, so please use the audacity-fixes-3.1.3 branch. It's
   the default branch on our GitHub copy:

      https://github.com/audacity/wxWidgets/tree/audacity-fixes-3.1.3

   You can be certain the correct branch is active with:

      git checkout audacity-fixes-3.1.3

4) Change directory to the folder where wxWidgets was cloned and build it using:

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

5) The config command should return "3.1.3" if the install was successful:

      /usr/local/x86_64/bin/wx-config --version

6) Now that you have wxWidgets installed, edit your ~/.bash_profile or
   ~/.zprofile and add:

      export WX_CONFIG=/usr/local/x86_64/bin/wx-config

   Log out and back in again (or reboot) for this to take effect.

7) Download the CMake 3.16.4 DMG from:

      https://cmake.org/download

8) Double click the DMG, follow the prompts and drag the CMake app to the
   Applications folder.

   If you will be building from the command line, open the CMake application
   and click the "Tools -> How to Install For Command Line Use" menu. It will
   give you additional instructions on making CMake available to the command
   line.

   You are now ready to start building Audacity.

BUILDING USING THE CMAKE GUI

   NOTE: Building with the GUI interface will result in the downloading of
         another copy of wxWidgets from Audacity.

1) Open the app.

2) Click the "Browse Source..." button and locate the top of your Audacity
   source tree, then click the "Open" button.

3) Click the "Browse Build..." button and find the location where you want to
   put the build (use the "New Folder" button at the bottom left to create a
   new folder).

   This folder does not have to be in or even near the source tree, but it
   must not be the same as the source tree. However, it is common to make it
   a subdirectory of the Audacity source tree.

4) Click the "Configure" button and when the dialog pops up, select "Xcode" for
   the generator, then click the "Done" button.

5) Click the "Generate" button to create the Xcode project.

6) Now you can either click the "Open Project" button or go to your "Build" folder in
   Finder and open the Xcode project as normal.

BUILDING FROM THE COMMAND LINE

1) Change directory to your Audacity source tree.

      cd audacity

2) Create the "build" folder (name it anything you like):

      mkdir bld

3) Change to the "build" folder:

      cd bld

4) Configure and generate the Xcode project:

      cmake -G Xcode ..

5) Build Audacity using the CMake command or xcodebuild:

      cmake --build . --config Release

      xcodebuild --configuration Release

   The "Audacity.app" bundle will be in the "bin/Release" subdirectory of your
   "build" folder, so you can start it via Finder or:

      open bin/Release/Audacity.app

Notes:

   - If you'd like to get a completely clean build, just delete "build" folder
     and return to step 2 above.

   - Once the Xcode project is generated, you shouldn't have to "configure" or
     "generate" again as it will be done for you automatically after pulling
     updates and building.

     For example:

        cd <audacity> directory
        git pull
        cd bld
        cmake --build . --config Release

   - Instructions on optional signing of DMGs, showing languages other than English,
     and other useful information can be found on our wiki at: 
     http://wiki.audacityteam.org/wiki/Building_On_Mac

CMake Build

1) Change directory to your Audacity source tree.

      cd audacity

2) Create the "build" folder (name it anything you like):

      mkdir bld

3) Change to the "build" folder:

      cd bld

4) Configure and generate the Xcode project:

      cmake -G Xcode ..

5) Build Audacity using the CMake command or xcodebuild:

      cmake --build . --config Release

      xcodebuild --configuration Release

   The "Audacity.app" bundle will be in the "bin/Release" subdirectory of your
   "build" folder, so you can start it via Finder or:

      open bin/Release/Audacity.app

For a Release CMake build

Additionally:

6) Add the help files

   Open contents of bin/Release/Audacity.app
   Add in files with directory help/manual/ and then the 5 top level items

7) Notarize Audacity

   ../mac/scripts/build_dist.sh ../mac ../bld/bin/Release

For Notarization to work, you'll need to have already jumped through the Apple hoops, and have set up your signing file. There are two stages to notarization, one for the bundle, one for the dmg.

To test the Notarization, upload the dmg to dropbox and then download it again. Then double-click to install and drag across to /Applications. When you launch Audacity, you now get a warning about having downloaded from the internet, rather than being prevented from running...


Optional Extras

Bulb icon FFmpeg and LAME

For these, see Building Extras on Mac

Variations

These instructions for variations on building aren't in mac/build.txt in the Git repo. They're actually mostly obsolete instructions. The CMake building now takes care of the GitIdent and mod-script-pipe. Languages should not be an issue if you are already set up with gettext. The signing has been replaced by Notarization. We no longer declutter the dmg, and no one has complained or commented about it on the forums.

Fetching The Manual

We have instructions for fetching the manual on another page.


Defaulting to Portable Settings

 1. Within audacity.app/Contents add the directories:
    Portable Settings
    Portable Settings/AutoSave

 2. Set permissions on these two directories to 777
    chmod 777 "Portable Settings"
    chmod 777 "Portable Settings/AutoSave"

These steps should of course be done before signing.

Official Full Releases

Official Audacity full releases:

  • Have a GitIdent, visible in the about box build information, that says what branch was used in building.
  • Include a copy of the manual.
  • Include other languages.
  • Have a de-cluttered .dmg (the folders in it are dragged outside the visible area)
  • Are signed with a signing key.

Updating GitIdent

 The Audacity "About" box can contain a link to the git commit at which 
 Audacity was built. To create this, run this batch script in /mac/scripts/
 
   get_gitident.sh
 
 If you do this, you are responsible for making sure the ident is correct
 in future builds.  The script overwrites RevisionIdent.h in the src directory.
 If you make further changes to your local copy after this step, or merge a
 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

Include mod-script-pipe

Build this within the Xcode project ON THE SAME DAY as you built audacity. You can click on the .so in the IDE to find out where Xcode put it (it will have some weird long temporary path).

Just before code signing, add it in to the Audacity bundle, into a subdirectory called 'modules'.

Include Languages

Warning icon Beware! Audacity needs a clean and then a recompile if it is to include languages.

For some reason yet to be investigated, incremental compiles will not include the language files in audacity.app.
(Check by looking inside the app and looking in 'Resources')

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

Then clean and recompile.
Incremental compiles will NOT include the language files.

Decluttering the dmg

 1. Open the dmg

 2. Drag the right border wider.

 3. Drag all folders that should not be visible into that area.

 4. Drag right border narrower again.


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) Delete any previous /private/tmp/TMP.dmg and /private/tmp/Audacity.dst
    (otherwise, the rebuilt plug-ins folder will contain an unnecessary duplicate
    of itself).

    Then 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

 4a) Not part of the signing, but a good idea to de-clutter the dmg
    per instructions in the section above.
 
 5) Codesign the app (deep to make sure everything important is signed)
     
    codesign --deep -s <identity> -v "/Volumes/Audacity 2.2.0/Audacity.app"

    If you see errors like this, no matter what size you used in step (3):

        can't allocate code signature data for: /Volumes/Audacity 2.2.0/Audacity.app/Contents/MacOS/Audacity
        (for architecture i386) because larger updated load commands do not fit (the program must be relinked
        using a larger -headerpad value)

    Then in the XCode project, add -headerpad_max_install_names to Other Linker flags (OTHER_LDFLAGS)
    for Release configuration of the Audacity target, and go back to step (2).
 
 6) Check it is signed to gatekeeper's satisfaction:
 
    spctl -a -v "/Volumes/Audacity 2.2.0/Audacity.app"
 
 7) unmount the dmg

    hdiutil eject "/Volumes/Audacity 2.2.0"
 
 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