Mac OS X Build Prerequisites

  • Revision slug: Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites
  • Revision title: Mac OS X Build Prerequisites
  • Revision id: 320413
  • Created:
  • Creator: Jonathan_Watt
  • Is current revision? No
  • Comment Add warning about the install location of more recent versions of Xcode

Revision Content

Note: Substantive changes to this page (non-editorial) should be reviewed by Mark Mentovai (mark@moxienet.com), or one of the build-config peers.

Mozilla builds for Mac OS X are Mach-O builds, built from Makefiles. Doing builds on Mac OS X is therefore very similar to doing Unix/Linux builds. You should be comfortable using the Terminal app (in /Applications/Utilities). Additional instructions are available for building Mozilla as a universal binary.

If you run into problems, see the Mozilla Build Frequently Asked Questions or the rest of the Mozilla build documentation.

{{ BuildDocsTOC() }}

One-Line Bootstrap

If you want to get running quickly, try running the following in a terminal:

wget https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py && python bootstrap.py

This will help you install all the build prerequisites for OS X. if that doesn't work, read on for how to do it all manually.

General build steps

Building on OS X is divided into the following steps:

  1. Install Apple-distributed developer tools
  2. Install supplementary build tools
  3. Obtain a copy of the Mozilla source code
  4. Configure the Mozilla source tree to suit your needs
  5. Build

1. Install Apple developer tools

For all versions of OS X, you will need to install Xcode to build any Mozilla application.

You can download and install Xcode from:

  • https://developer.apple.com/downloads/index.action (Apple ID required, but subscription and credit card info not required.)
  • The Apple App Store (in newer versions of OS X)
    • Note that you need to run /Applications/Install Xcode.app after installing Xcode via the App Store. This, however, may fail due to "untrusted package" error. One known workaround to this is to set the computer's clock back temporarily to 1/1/2010 and trying the installation again.
    • Newer versions of Xcode have been repackaged. To install the command line tools, start Xcode, open preferences, go to Downloads and install Command line tools.
  • The Mac OS X Install DVD that came with your computer. The Xcode or XcodeTools installer should be located in the "Optional Installs" folder. If possible, you should obtain Xcode from the Internet to ensure you have an up-to-date version.

Note that for Xcode 4.5 and later the expected install location is /Applications/Xcode.app and not /Developer/Applications/Xcode.app

Generally, any released version of Xcode should build the latest version of a Mozilla source tree. However, early adopters of new and beta Xcode releases may see incompatibilities. Therefore, heed caution when upgrading OS X and Xcode.

The compatibility of various OS X and Xcode versions is listed in the Software Requirements section below.

2. Install supplementary build tools

Mozilla's source tree requires a number of 3rd party tools and applications to build it. You will need to install these before you can build anything.

You have the choice over how to install all these components. You can use a package manager like Homebrew or Ports. Or, you can obtain, compile, and install them individually. For simplicity and to save your time, using a package manager is recommended. The following sections describe how to install the packages using existing package managers. Choose whatever package manager you prefer.

You can also use these package managers to install Clang if your version of XCode doesn't have it already.

2.1a Install Dependencies via Homebrew

Homebrew is "the missing package manager for OS X." It provides a simple command-line interface to install packages, typically by compiling them from source.

The first step is to install Homebrew. See https://github.com/mxcl/homebrew/wiki/installation

Once you have Homebrew installed, you'll need to run the following:

$ brew install yasm mercurial gawk

Depending on the version of Xcode you are using, "brew install mercurial" may fail due to a missing Mac OS 4 universal SDK. You may work around this issue by directly installing mercurial binary from this site, and installing yasm and libidl only using brew.

The primary Homebrew repository does not retain formulas for older versions of software, but a repository of older versions exists. To install autoconf 2.13, you can just point to that formula directly (no need to download it first):

$ brew install https://raw.github.com/Homebrew/homebrew-versions/master/autoconf213.rb

2.1b Install Dependencies via MacPorts

MacPorts is a package manager for OS X. If you are running Homebrew, you can ignore this section.

To install MacPorts, go to their install page, download the .dmg for your platform, and install it. If you already have MacPorts installed, ensure it is up to date by running:

$ sudo port selfupdate
$ sudo port sync

The first of these commands will ask for your root password.

Common errors include:

  • sudo doesn't accept a blank password: create a password for your account in System Preferences.
  • port command not found: add it to your path (see troubleshooting section below).

Use MacPorts to install the packages needed for building Firefox:

$ sudo port install libidl autoconf213 yasm

You'll then see lots of output as MacPorts builds and installs these packages and their dependencies -- it takes a while, so go grab a cup of coffee.

Note: By default, this will install Python 2.7, which in turn will pull in all of the X11 libraries, which may take a while to build.  You don't need any of those to build Firefox; you may want to consider adding +no_tkinter to the install line to build a python without support for the X11 UI packages.  This should result in a much faster install.

2.2 Install Mercurial

Mozilla's source code is hosted in Mercurial repositories. You use Mercurial to interact with these repositories. There are many ways to install Mercurial on OS X:

  1. Install official builds from Selenic
  2. Install via MacPorts:
    1. $ sudo port install mercurial
  3. Install via Homebrew:
    1. $ brew install mercurial
  4. Install via Pip
    1. $ easy_install pip && pip install mercurial

Once you have installed Mercurial, test it by running:

$ hg version

If this works, congratulations! You'll want to configure your Mercurial settings to match other developers. See Getting Mozilla Source Code Using Mercurial.

If this fails with the error "ValueError: unknown locale: UTF-8", then see the workarounds on the Mercurial wiki's Unix Install page.

When trying to clone a repository you may get an HTTP 500 error (internal server error). This seems to be due to something that Mac Mercurial sends to the server (it's been observed both with MacPort and selenic.com Mercurial binaries). Try restarting your shell, your computer, or reinstall Mercurial (in that order) then report back here what worked, please.

3. Obtain Mozilla source code

You may want to read Getting Mozilla Source Code Using Mercurial for the complete instructions. If you are interested in Firefox development,

# The following will create a new directory, mozilla-central, in the
# current one with the contents of the remote repository. This command
# will take many minutes to run, as it will be copying a couple hundred
# megabytes of data over the internet.

$ hg clone https://hg.mozilla.org/mozilla-central/ mozilla-central
$ cd mozilla-central

4. Configure source tree for build options

In your checked out source tree, you'll create a new file, .mozconfig, which contains your build options. For more on this file, see Configuring Build Options.

To quickly get started, create the file .mozconfig file in your source tree clone with the following contents:

# Import the stock config for building the browser (Firefox)
. $topsrcdir/browser/config/mozconfig

# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-dbg

# -s makes builds quieter by default
# -j4 allows 4 tasks to run in parallel. Set the number to be the amount of
# cores in your machine. 4 is a good number.
mk_add_options MOZ_MAKE_FLAGS="-s -j4"

# Enable debug builds
ac_add_options --enable-debug

# Turn off compiler optimization. This will make applications run slower,
# will allow you to debug the applications under a debugger, like GDB.
ac_add_options --disable-optimize

64-bit builds require the 10.6 SDK or higher and 32-bit builds require the 10.5 SDK or higher. If you'd like to ensure compatibility with an operating system version previous to the one you are building on you can explicitly specify an SDK by adding a line like this:

ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk

Firefox no longer builds with gcc 4.2, but the build system should automatically select clang if it is available in the PATH. If that is not the case, you need to set CC and CXX.  For instance, if you installed Clang 3.1 via Homebrew, then you need to have

CC=clang-mp-3.1
CXX=clang++-mp-3.1

If you installed autoconf 2.13 with the Homebrew recipe linked above, you'll need to add the following to your .mozconfig:

mk_add_options AUTOCONF=/usr/local/Cellar/autoconf213/2.13/bin/autoconf213

5. Build

Once you have your .mozconfig file in place, you should be able to build!

For your first build, we'll split this in steps to ensure each one runs properly:

# The next command will verify your build environment is sufficient. If
# the last lines of output look like an error, it didn't work. See the
# sections below for help.

$ make -f client.mk configure

# The next command will actually build the application! This could take
# over an hour on older machines.

$ make -f client.mk build

If the build step works, you should be able to find the built application inside obj-ff-dbg/dist/. If building the browser, the name of the application is Nightly.app. Try running the following:

$ open obj-ff-dbg/dist/Nightly.app
Note: The compiled application may also be named after the branch you're building; for example, if you changed these instructions to fetch the mozilla-1.9.2 branch, the application will be named Namoroka.app or NamorokaDebug.app.

Hardware requirements

There are no specific hardware requirements, provided that the hardware accommodates all of the software required to build Mozilla. Mozilla can take a very long time to build, so recommended development systems are listed alongside the minimum requirements.

  • Processor: PowerPC G4 or later, PowerPC G5 or Intel CPUs recommended. Mozilla can now be built for either type of processor, or as a universal binary for both types (see Mac OS X Universal Binaries).
  • Memory: 256MB RAM minimum, 1GB recommended.
  • Disk Space: At least 1GB of free disk space for non-debug builds; development/debug builds require at least 2.5GB of free disk space.

Software requirements

  • Operating System: Mac OS X 10.5.8 or later. It is advisable to upgrade to the latest “point” release (currently 10.5.8 and 10.6.6) by running Software Update, found in the Apple menu.
    • Beginning with Mozilla 1.9.3 (mozilla-central), Mac OS X 10.5 is both a build- and run-time requirement; for 64-bit builds, Mac OS X 10.6 is both a build- and run-time requirement.
    • Beginning with Mozilla 1.9 (cvs trunk), Mac OS X 10.4 is both a build- and run-time requirement.
    • Mozilla’s 1.8.0 and 1.8.1 branches will run on Mac OS X 10.2 (“Jaguar”), but the build requires a minimum of 10.3 (“Panther”).
    • No recent version of Mozilla will build or run on 10.1 (“Puma”).
    • For additional details, see the Mac compatibility matrix.

To install the following software requirements, you may need administrative privileges on the system.

  • Development Environment: Xcode 4.1 or later. Tested Xcode configurations are listed in the Mac compatibility matrix. There are three ways to obtain or upgrade Xcode:
    • Download: Download Xcode from Apple. This ensures that you’ll install the latest version of the tools available for your computer. You’ll need a (free) Apple Developer Connection membership. Note that Xcode updates are not installed by Software Update at this time.
    • The OS X App Store.
    • DVD or CD: Most Macs and retail versions of Mac OS X include an Xcode installer on the installation discs. Check your discs for Xcode or Developer Tools.
  • Package Management: A package management system is not strictly required, but simplifies the installation of additional build dependencies. There are two package management systems that are compatible with the Mozilla build system, Fink and MacPorts (formerly DarwinPorts). Note that package installation may be a time-consuming but automated process using either tool.
    • MacPorts, formerly DarwinPorts. You may download the MacPorts installer corresponding to your operating system release. MacPorts installs in /opt/local by default. After running the MacPorts installer, the changes that it makes to the shell environment will be available in any new Terminal window.
    • fink (not recommended).
  • libIDL and GLib, libraries used by Mozilla’s IDL (interface definition language) file parser. These may be installed using MacPorts using the commands listed below. Glib is installed automatically as part of the libidl install. Administrative privileges are required, provide your password to the sudo command if requested:
    $ sudo port sync
    $ sudo port install libidl +universal
    
    The above command builds libidl as a universal binary, making it possible to link Mozilla under any MacOSX architecture.
  • autoconf version 2.13 is needed if you plan on making changes to the Mozilla configure.in files on versions up to 1.9 and when building from mozilla-central. Newer versions of autoconf, including those that come with Xcode and installed in /usr/bin, are incompatible with Mozilla ({{ Bug(104642) }}).
    $ sudo port install autoconf213
    

    The above commands install autoconf-2.13 to /opt/local/bin/autoconf213 using MacPorts. You will need to type autoconf213 to run it when other documentation might instruct you to run autoconf. Do not install the autoconf package without the 213 suffix.

    When building from mozilla-central, use mk_add_options AUTOCONF=autoconf213 in your .mozconfig

  • Mercurial source control system (if you're planning to work on post-1.9.0 code). See Mercurial#Installing.
  • To build the Mozilla 1.9.0, 1.9.1, or 1.9.2 branches on a Mac OS X 10.4 build host, additional packages are required, so run the following command to obtain them:
    $ sudo port install python py25-zlib py25-hashlib
    

.mozconfig options and other tunables

These options are specific to Mozilla builds for Mac OS X. For a more general overview of build options and the .mozconfig file, see Configuring Build Options. For specific information on configuring to build a universal binary, see Mac OS X Universal Binaries.

  • Compiler: Firefox releases are no longer built with gcc-4.2. A recent copy of clang is needed.
  • See the discussion here: gcc 4.2 - Clang Switch Discussion
  • There are a some options on where to get clang:
    • Newer versions of xcode. The one in xcode 4.1 or newer and the open source 3.1 release should work.
    • Following the instructions in the clang web site for information on how to get it.
    • Using some of the package managers (see above).
    • Once bug 768879 is fixed, you should be able to download the same packages used by the bots.
    Once clang is installed, make sure it is on the PATH and configure should use it.

The following options, specified with ac_add_options, are lines that are intended to be added to your .mozconfig file.

  • Mac OS X SDK: This selects the version of the system headers and libraries to build against, ensuring that the product you build will be able to run on older systems with less complete APIs available. Selecting an SDK with this option overrides the default headers and libraries in /usr/include, /usr/lib, and /System/Library. Mac OS X SDKs are installed in /Developer/SDKs during the Xcode installation by selecting the Cross Development category in the installer’s Customize screen.
    ac_add_options --with-macos-sdk=/path/to/SDK
    

    Official trunk builds now use /Developer/SDKs/MacOSX10.5.sdk but prior to 2009-09-14 used /Developer/SDKs/MacOSX10.4u.sdk. The 1.9.x branches use /Developer/SDKs/MacOSX10.4u.sdk. On the 1.8.0 and 1.8.1 branches, official PowerPC builds use /Developer/SDKs/MacOSX10.2.8.sdk, while official Intel builds use /Developer/SDKs/MacOSX10.4u.sdk.
    Building with --enable-dtrace requires the 10.5 SDK: --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk

    Note that some frameworks (notably AppKit) behave differently at runtime depending on which SDK was used at build time. This may be the source of bugs that only appear on certain platforms or in certain builds.

    You will not be able to build Mozilla using the 10.2.8 SDK included in the Xcode 2.4 installer. If you install Xcode 2.4, please see the Mac OS X Prerequisites#Troubleshooting section for a workaround. Upgrade to Xcode 2.4.1 or newer.

    Use of an SDK is highly recommended, especially when building on Mac OS X 10.3 with Xcode 1.5.
  • Deployment Target: This option selects the minimum OS version that the resulting application will run on. Proper use of this option requires additional support in the code.
    ac_add_options --enable-macos-target=version
    
    This option is not recommended. The default for the trunk on all platforms is 10.5, while on the 1.9.0-1.9.2 branches it is 10.4. The default for PowerPC builds on the 1.8.0 and 1.8.1 branches is 10.3, while the default for Intel builds on those branches is 10.4. Official builds use these defaults.
  • Prebinding: The Mozilla build system allows you to build an application and libraries that are prebound. This improves application launch time on Mac OS X 10.3.3 and earlier.
    ac_add_options --enable-prebinding
    
    The default is to not prebind. Official PowerPC builds are prebound. Official Intel builds are not prebound, as no Intel build will run on any release earlier than 10.4.
  • Sample .mozconfig: This .mozconfig file is suitable to build an Intel version of Minefield (equivalent to Firefox), which will only run on Intel-based Macs running Mac OS X 10.5 or newer:
    . $topsrcdir/browser/config/mozconfig
    ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
    ac_add_options --disable-tests

Build defines

For Mac OS X builds, defines are set up as follows:

  • XP_MACOSX is defined
  • XP_UNIX is defined
  • XP_MAC is not defined. XP_MAC is obsolete and is slowly being removed from the source tree (see {{ Bug(281889) }}). It was used for CFM (non-Mach-O) builds for the classic (pre-X) Mac OS.

This requires care when writing code for Unix platforms that exclude Mac:

#if defined(XP_UNIX) && !defined(XP_MACOSX)

Troubleshooting

  • Unable to build with GCC. Apple used to ship a GCC based on vanilla GCC 4.2. They still ship LLVM-GCC (which is also base on GCC 4.2). Mozilla does not support building with any GCC 4.2 variant anymore. On OS X, non-Apple (i.e. stock) GCC are also not supported (they don't support blocks), so you must use clang on OS X.
  • After installing Xcode 2.4, the build fails in nsLookAndFeel.cpp with:
    error: `kThemeBrushAlternatePrimaryHighlightColor' undeclared (first use this function).

    The 10.2.8 SDK included in Xcode 2.4 (build 8K1079) contains a bug that prevents Mozilla from building with that SDK. Apple has been notified of this bug, which is being tracked as Radar 4671592. This bug has been fixed as of Xcode 2.4.1.

  • QuickTime SDK Update: If you install or update QuickTime 7, you may also need to install an updated QuickTime SDK, available from “Software Update” in the Apple menu. This update is only needed if Software Update indicates that it is available to you. You will need this update if your build fails because it is unable to find Sound.
  • Using Fink, you get apt-get: command not found.

    apt-get is not in your $PATH. Close and reopen Terminal and try again. If the error persists, Fink was unable to fully configure itself in your environment. Take these steps:

    • If you use the bash shell, the default since Mac OS X 10.3, edit your ~/.bashrc file, adding the following line. Don’t neglect the leading period and space.
      . /sw/bin/init.sh
      
    • If you use the tcsh shell, edit your ~/.tcshrc file, adding the following line:
      source /sw/bin/init.csh
      
  • Using MacPorts (DarwinPorts), you get port: command not found.

    port is not in your $PATH. Close and reopen Terminal and try again. If the error persists, DarwinPorts was unable to fully configure itself in your environment. Take these steps:

    • If you use the bash shell, the default since Mac OS X 10.3, edit your ~/.profile (or ~/.bash_profile or ~/.bash_login, if either exists) file, adding the following line:
      export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
      
    • If you use the tcsh shell, edit your ~/.tcshrc file, adding the following line:
      setenv PATH "/opt/local/bin:/opt/local/sbin:$PATH"
      
    • After modifying the appropriate file, close and reopen Terminal and try again.
  • Using Fink with Virex 7.2: There is a conflict between Fink and Virex 7.2. Both place files within /sw. If you have Virex installed, you will need to upgrade to at least version 7.2.1, as described in the Fink News (2003-04-16).
  • The build stops while building libwidget.rsrc in widget/src/mac

    Delete, or rename ~/Library/Preferences/.GlobalPreferences.plist. We're not quite sure what setting in that file is causing this problem. Note that if you remove this file, system preferences such as preferred locales and recent programs will also disappear.

  • The build complains about missing IDL headers: Make sure you installed the orbit distribution via Fink's apt-get, and that you edited your .bashrc to source the /sw/bin/init.sh file or your .tcshrc file to source the /sw/bin/init.csh file.
  • Can't find dlfcn.h with error nsTraceRefcnt.cpp:68: dlfcn.h: No such file or directory

    Make sure you have the libdl.dylib from Fink. If you install bash from Apple, it will provide a copy of libdl.dylib which will not come with the headers (eg. dlfcn.h) needed to compile new programs that use the library, such as Mozilla. The solution is to remove the bash from Apple and install the bash from Fink. (Thanks to Alex Stewart for helping us track this down.)

  • Error: Failed to install db46

  • Error: Target org.macports.build returned: shell command failed (see log for details)
    Error: Failed to install db46
    Log for db46 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_db46/main.log
    Error: The following dependencies were not installed: python26 db46 gdbm gettext expat libiconv gperf ncurses ncursesw openssl zlib readline sqlite3
    Error: Status 1 encountered during processing.
    To report a bug, see <http://guide.macports.org/#project.tickets>
    
  • Mac OS X 10.6.5 and newer have removed a file necessary to build db46, which is a prerequisite for some of the MacPorts packages we require. You can get this file by installing the Java Developer Package for Mac.

Building with --enable-dtrace fails with configure: error: dtrace enabled but sys/sdt.h not found 

Make sure you use the 10.5 SDK, not 10.4 as in the default configuration.

Forcing 32-bit builds

Currently, 64-bit compilation is the default.  If you want to build a 32-bit version of Firefox on Mac OS X, you can append the following lines to your .mozconfig in order to force the build process to produce a 32-bit version of Firefox.

CC="clang -arch i386"
CXX="clang++ -arch i386"
ac_add_options --target=i386-apple-darwin9.2.0
ac_add_options --enable-macos-target=10.5

HOST_CC="clang-4.2"
HOST_CXX="clang++-4.2"
RANLIB=ranlib
AR=ar
AS=$CC
LD=ld
STRIP="strip -x -S"
CROSS_COMPILE=1

Revision Source

<p><span class="comment">Note: Substantive changes to this page (non-editorial) should be reviewed by Mark Mentovai (<a class="link-mailto" href="mailto:mark@moxienet.com" rel="freelink">mark@moxienet.com</a>), or one of the build-config peers.</span></p>
<p>Mozilla builds for Mac OS X are Mach-O builds, built from Makefiles. Doing builds on Mac OS X is therefore very similar to doing <a href="/En/Developer_Guide/Build_Instructions/Linux_Prerequisites" title="en/Linux_Build_Prerequisites">Unix/Linux builds</a>. You should be comfortable using the Terminal app (in <code>/Applications/Utilities</code>). Additional instructions are available for <a href="/en/Mac_OS_X_Universal_Binaries" title="en/Mac_OS_X_Universal_Binaries">building Mozilla as a universal binary</a>.</p>
<p>If you run into problems, see the <a href="/en/Developer_Guide/Mozilla_build_FAQ" title="en/Mozilla_Build_FAQ">Mozilla Build Frequently Asked Questions</a> or the rest of the <a href="/En/Developer_Guide/Build_Instructions" title="en/Build_Documentation">Mozilla build documentation</a>.</p>
<p>{{ BuildDocsTOC() }}</p>
<h2 id="One-Line_Bootstrap">One-Line Bootstrap</h2>
<p>If you want to get running quickly, try running the following in a terminal:</p>
<pre>
<span class="difflineplus">wget https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py &amp;&amp; python bootstrap.py</span></pre>
<p><span class="difflineplus">This will help you install all the build prerequisites for OS X. if that doesn't work, read on for how to do it all manually.</span></p>
<h2 id="Firefox_Quick_Start" name="Firefox_Quick_Start">General build steps</h2>
<p>Building on OS X is divided into the following steps:</p>
<ol>
  <li>Install Apple-distributed developer tools</li>
  <li>Install supplementary build tools</li>
  <li>Obtain a copy of the Mozilla source code</li>
  <li>Configure the Mozilla source tree to suit your needs</li>
  <li>Build</li>
</ol>
<h3 id="Firefox_Quick_Start" name="Firefox_Quick_Start">1. Install Apple developer tools</h3>
<p>For all versions of OS X, you will need to install Xcode to build any Mozilla application.</p>
<p>You can download and install Xcode from:</p>
<ul>
  <li><a href="https://developer.apple.com/downloads/index.action" title="https://developer.apple.com/downloads/index.action">https://developer.apple.com/downloads/index.action</a> (Apple ID required, but subscription and credit card info not required.)</li>
  <li>The Apple App Store (in newer versions of OS X)
    <ul>
      <li>Note that you need to run /Applications/Install Xcode.app after installing Xcode via the App Store. This, however, may fail due to "untrusted package" error. One known workaround to this is to set the computer's clock back temporarily to 1/1/2010 and trying the installation again.</li>
      <li>Newer versions of Xcode have been repackaged. To install the command line tools, start Xcode, open preferences, go to Downloads and install Command line tools.</li>
    </ul>
  </li>
  <li>The Mac OS X Install DVD that came with your computer. The Xcode or XcodeTools installer should be located in the "Optional Installs" folder. If possible, you should obtain Xcode from the Internet to ensure you have an up-to-date version.</li>
</ul>
<div class="warning">
  <p>Note that for Xcode 4.5 and later the expected install location is /Applications/Xcode.app and not /Developer/Applications/Xcode.app</p>
</div>
<p>Generally, any released version of Xcode should build the latest version of a Mozilla source tree. However, early adopters of new and beta Xcode releases may see incompatibilities. Therefore, heed caution when upgrading OS X and Xcode.</p>
<p>The compatibility of various OS X and Xcode versions is listed in the Software Requirements section below.</p>
<h3 id="Firefox_Quick_Start" name="Firefox_Quick_Start">2. Install supplementary build tools</h3>
<p>Mozilla's source tree requires a number of 3rd party tools and applications to build it. You will need to install these before you can build anything.</p>
<p>You have the choice over how to install all these components. You can use a package manager like Homebrew or Ports. Or, you can obtain, compile, and install them individually. For simplicity and to save your time, using a package manager is recommended. The following sections describe how to install the packages using existing package managers. Choose whatever package manager you prefer.</p>
<p>You can also use these package managers to install Clang if your version of XCode doesn't have it already.</p>
<h4 id="2.1a_Install_Dependencies_via_Homebrew">2.1a Install Dependencies via Homebrew</h4>
<p><a class="external" href="http://mxcl.github.com/homebrew/" title="http://mxcl.github.com/homebrew/">Homebrew</a> is "the missing package manager for OS X." It provides a simple command-line interface to install packages, typically by compiling them from source.</p>
<p>The first step is to install Homebrew. See <a class="link-https" href="https://github.com/mxcl/homebrew/wiki/installation" rel="freelink">https://github.com/mxcl/homebrew/wiki/installation</a></p>
<p>Once you have Homebrew installed, you'll need to run the following:</p>
<pre>
$ brew install yasm mercurial gawk
</pre>
<p>Depending on the version of Xcode you are using, "brew install mercurial" may fail due to a missing Mac OS 4 universal SDK. You may work around this issue by directly installing mercurial binary from <a href="/this_http://mercurial.berkwood.com/site" title="this http://mercurial.berkwood.com/site">this site</a>, and installing yasm and libidl only using brew.</p>
<p>The primary Homebrew repository does not retain formulas for older versions of software, but a&nbsp;<a class="link-https" href="https://github.com/Homebrew/homebrew-versions" title="https://github.com/Homebrew/homebrew-versions">repository of older versions</a>&nbsp;exists. To install autoconf 2.13, you can just point to that formula directly (no need to download it first):</p>
<pre>
$ brew install https://raw.github.com/Homebrew/homebrew-versions/master/autoconf213.rb
</pre>
<h4 id="2.1b_Install_Dependencies_via_MacPorts">2.1b Install Dependencies via MacPorts</h4>
<p>MacPorts is a package manager for OS X. If you are running Homebrew, you can ignore this section.</p>
<p>To install MacPorts, go to their <a class="external" href="http://www.macports.org/install.php" title="http://www.macports.org/install.php">install page</a>, download the .dmg for your platform, and install it. If you already have MacPorts installed, ensure it is up to date by running:</p>
<pre class="eval" style="margin-left: 40px;">
$ sudo port selfupdate
$ sudo port sync
</pre>
<p>The first of these commands will ask for your root password.</p>
<p>Common errors include:</p>
<ul>
  <li><code>sudo</code> doesn't accept a blank password: create a password for your account in System Preferences.</li>
  <li><code>port</code> command not found: add it to your path (see troubleshooting section below).</li>
</ul>
<p>Use MacPorts to install the packages needed for building Firefox:</p>
<pre class="eval" style="margin-left: 40px;">
$ sudo port install libidl autoconf213 yasm
</pre>
<p>You'll then see lots of output as MacPorts builds and installs these packages and their dependencies -- it takes a while, so go grab a cup of coffee.</p>
<div class="note">
  <strong>Note:</strong> By default, this will install Python 2.7, which in turn will pull in all of the X11 libraries, which may take a while to build.&nbsp; You don't need any of those to build Firefox; you may want to consider adding <span style="font-family: Courier New;">+no_tkinter</span> to the install line to build a python without support for the X11 UI packages.&nbsp; This should result in a much faster install.</div>
<h3 id="2.2_Install_Mercurial">2.2 Install Mercurial</h3>
<p>Mozilla's source code is hosted in Mercurial repositories. You use Mercurial to interact with these repositories. There are many ways to install Mercurial on OS X:</p>
<ol>
  <li>Install <a class="external" href="http://mercurial.selenic.com/">official builds from Selenic</a></li>
  <li>Install via MacPorts:
    <ol>
      <li>$ sudo port install mercurial</li>
    </ol>
  </li>
  <li>Install via Homebrew:
    <ol>
      <li>$ brew install mercurial</li>
    </ol>
  </li>
  <li>Install via Pip
    <ol>
      <li>$ easy_install pip &amp;&amp; pip install mercurial</li>
    </ol>
  </li>
</ol>
<p>Once you have installed Mercurial, test it by running:</p>
<pre>
$ hg version
</pre>
<p>If this works, congratulations! You'll want to configure your Mercurial settings to match other developers. See <a href="/En/Developer_Guide/Source_Code/Mercurial" title="Getting Mozilla Source Code Using Mercurial">Getting Mozilla Source Code Using Mercurial</a>.</p>
<p>If this fails with the error "ValueError: unknown locale: UTF-8", then see the <a class="external" href="http://www.selenic.com/mercurial/wiki/index.cgi/UnixInstall#head-1c10f216d5b9ccdcb2613ea37d407eb45f22a394" title="http://www.selenic.com/mercurial/wiki/index.cgi/UnixInstall#head-1c10f216d5b9ccdcb2613ea37d407eb45f22a394">workarounds</a> on the Mercurial wiki's Unix Install page.</p>
<p>When trying to clone a repository you may get an HTTP 500 error (internal server error). This seems to be due to something that Mac Mercurial sends to the server (it's been observed both with MacPort and selenic.com Mercurial binaries). Try restarting your shell, your computer, or reinstall Mercurial (in that order) then report back here what worked, please.</p>
<h3 id="3._Obtain_Mozilla_source_code">3. Obtain Mozilla source code</h3>
<p>You may want to read <a href="/En/Developer_Guide/Source_Code/Mercurial" title="Getting Mozilla Source Code Using Mercurial">Getting Mozilla Source Code Using Mercurial</a> for the complete instructions. If you are interested in Firefox development,</p>
<pre>
# The following will create a new directory, mozilla-central, in the
# current one with the contents of the remote repository. This command
# will take many minutes to run, as it will be copying a couple hundred
# megabytes of data over the internet.

$ hg clone https://hg.mozilla.org/mozilla-central/ mozilla-central
$ cd mozilla-central
</pre>
<h3 id=".C2.A04._Configure_source_tree_for_build_options"><span id="1240509853482S" style="display: none;">&nbsp;</span>4. Configure source tree for build options</h3>
<p>In your checked out source tree, you'll create a new file, <code>.mozconfig</code>, which contains your build options. For more on this file, see <a href="/en/Configuring_Build_Options" title="Configuring Build Options">Configuring Build Options</a>.</p>
<p>To quickly get started, create the file <code>.mozconfig</code> file in your source tree clone with the following contents:</p>
<pre class="eval">
# Import the stock config for building the browser (Firefox)
. $topsrcdir/browser/config/mozconfig

# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-dbg

# -s makes builds quieter by default
# -j4 allows 4 tasks to run in parallel. Set the number to be the amount of
# cores in your machine. 4 is a good number.
mk_add_options MOZ_MAKE_FLAGS="-s -j4"

# Enable debug builds
ac_add_options --enable-debug

# Turn off compiler optimization. This will make applications run slower,
# will allow you to debug the applications under a debugger, like GDB.
ac_add_options --disable-optimize
</pre>
<p>64-bit builds require the 10.6 SDK or higher and 32-bit builds require the 10.5 SDK&nbsp;or higher. If you'd like to ensure compatibility with an operating system version previous to the one you are building on you can explicitly specify an SDK&nbsp;by adding a line like this:</p>
<pre class="eval">
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
</pre>
<p>Firefox no longer builds with gcc 4.2, but the build system should automatically select clang if it is available in the PATH. If that is not the case, you need to set CC and CXX. &nbsp;For instance, if you installed Clang 3.1 via Homebrew, then you need to have</p>
<pre class="eval">
CC=clang-mp-3.1
CXX=clang++-mp-3.1</pre>
<p>If you installed autoconf 2.13 with the Homebrew recipe linked above, you'll need to add the following to your <code>.mozconfig</code>:</p>
<pre class="eval">
mk_add_options AUTOCONF=/usr/local/Cellar/autoconf213/2.13/bin/autoconf213
</pre>
<h3 id="5._Build">5. Build</h3>
<p>Once you have your <code>.mozconfig</code> file in place, you should be able to build!</p>
<p>For your first build, we'll split this in steps to ensure each one runs properly:</p>
<pre>
# The next command will verify your build environment is sufficient. If
# the last lines of output look like an error, it didn't work. See the
# sections below for help.

$ make -f client.mk configure

# The next command will actually build the application! This could take
# over an hour on older machines.

$ make -f client.mk build
</pre>
<p>If the build step works, you should be able to find the built application inside <code>obj-ff-dbg/dist/</code>. If building the browser, the name of the application is <code>Nightly.app</code>. Try running the following:</p>
<pre>
$ open obj-ff-dbg/dist/Nightly.app
</pre>
<div class="note">
  <strong>Note:</strong> The compiled application may also be named after the branch you're building; for example, if you changed these instructions to fetch the <code>mozilla-1.9.2</code> branch, the application will be named <code>Namoroka.app</code> or <code>NamorokaDebug.app</code>.</div>
<h2 id="Hardware_Requirements" name="Hardware_Requirements">Hardware requirements</h2>
<p>There are no specific hardware requirements, provided that the hardware accommodates all of the <a href="#Software_Requirements">software</a> required to build Mozilla. Mozilla can take a very long time to build, so recommended development systems are listed alongside the minimum requirements.</p>
<ul>
  <li><strong>Processor:</strong> PowerPC G4 or later, PowerPC G5 or Intel CPUs recommended. Mozilla can now be built for either type of processor, or as a universal binary for both types (see <a href="/en/Mac_OS_X_Universal_Binaries" title="en/Mac_OS_X_Universal_Binaries">Mac OS X Universal Binaries</a>).</li>
  <li><strong>Memory:</strong> 256MB RAM minimum, 1GB recommended.</li>
  <li><strong>Disk Space:</strong> At least 1GB of free disk space for non-debug builds; development/debug builds require at least 2.5GB of free disk space.</li>
</ul>
<h2 id="Software_Requirements" name="Software_Requirements">Software requirements</h2>
<ul>
  <li><strong>Operating System:</strong> Mac OS X 10.5.8 or later. It is advisable to upgrade to the latest “point” release (currently 10.5.8 and 10.6.6) by running Software Update, found in the Apple menu.
    <ul>
      <li>Beginning with Mozilla 1.9.3 (mozilla-central), Mac OS X 10.5 is both a build- and run-time requirement; for 64-bit builds, Mac OS X 10.6 is both a build- and run-time requirement.</li>
      <li>Beginning with Mozilla 1.9 (cvs trunk), Mac OS X 10.4 is both a build- and run-time requirement.</li>
      <li>Mozilla’s 1.8.0 and 1.8.1 branches will run on Mac OS X 10.2 (“Jaguar”), but the build requires a minimum of 10.3 (“Panther”).</li>
      <li>No recent version of Mozilla will build or run on 10.1 (“Puma”).</li>
      <li>For additional details, see the <a class="external" href="http://wiki.mozilla.org/Mac:Build_Requirements#Compatibility_Matrix">Mac compatibility matrix</a>.</li>
    </ul>
  </li>
</ul>
<p>To install the following software requirements, you may need administrative privileges on the system.</p>
<ul>
  <li><strong>Development Environment:</strong> <a class="external" href="http://developer.apple.com/tools/xcode/">Xcode</a>&nbsp;4.1 or later. Tested Xcode configurations are listed in the <a class="external" href="http://wiki.mozilla.org/Mac:Build_Requirements#Compatibility_Matrix">Mac compatibility matrix</a>. There are three ways to obtain or upgrade Xcode:
    <ul>
      <li><em>Download:</em> <a class="external" href="http://developer.apple.com/tools/download/">Download Xcode</a> from Apple. This ensures that you’ll install the latest version of the tools available for your computer. You’ll need a (free) <a class="external" href="http://connect.apple.com/">Apple Developer Connection</a> membership. Note that Xcode updates are not installed by Software Update at this time.</li>
      <li>The OS X App Store.</li>
      <li><em>DVD or CD:</em> Most Macs and retail versions of Mac OS X include an Xcode installer on the installation discs. Check your discs for Xcode or Developer Tools.</li>
    </ul>
  </li>
  <li><strong>Package Management:</strong> A package management system is not strictly required, but simplifies the installation of additional build dependencies. There are two package management systems that are compatible with the Mozilla build system, Fink and MacPorts (formerly DarwinPorts). Note that package installation may be a time-consuming but automated process using either tool.
    <ul>
      <li><em><a class="external" href="http://www.macports.org/">MacPorts</a></em>, formerly DarwinPorts. You may <a class="external" href="http://www.macports.org/install.php">download</a> the MacPorts installer corresponding to your operating system release. MacPorts installs in <code>/opt/local</code> by default. After running the MacPorts installer, the changes that it makes to the shell environment will be available in any new Terminal window.</li>
      <li><a href="/en/Mac_OS_X_Build_Prerequisites//fink" title="en/Mac_OS_X_Build_Prerequisites//fink">fink</a> (not recommended).</li>
    </ul>
  </li>
  <li><strong><a class="external" href="http://andrewtv.org/libIDL/">libIDL</a></strong> and <strong><a class="external" href="http://www.gtk.org/">GLib</a></strong>, libraries used by Mozilla’s IDL (interface definition language) file parser. These may be installed using MacPorts using the commands listed below. Glib is installed automatically as part of the libidl install. Administrative privileges are required, provide your password to the <code>sudo</code> command if requested:
    <pre>
$ sudo port sync
$ sudo port install libidl +universal
</pre>
    The above command builds <code>libidl</code> as a universal binary, making it possible to link Mozilla under any MacOSX&nbsp;architecture.</li>
</ul>
<ul>
  <li><strong><a class="external" href="http://www.gnu.org/software/autoconf/">autoconf</a> version 2.13</strong> is needed if you plan on making changes to the Mozilla configure.in files on versions up to 1.9 and when <a href="/En/Developer_Guide/Source_Code/Mercurial" title="en/Mozilla_Source_Code_(Mercurial)">building from mozilla-central</a>. Newer versions of autoconf, including those that come with Xcode and installed in <code>/usr/bin</code>, are incompatible with Mozilla ({{ Bug(104642) }}).
    <pre>
$ sudo port install autoconf213
</pre>
    <p>The above commands install autoconf-2.13 to <code>/opt/local/bin/autoconf213</code> using MacPorts. You will need to type <code>autoconf213</code> to run it when other documentation might instruct you to run <code>autoconf</code>. Do not install the <code>autoconf</code> package without the <code>213</code> suffix.</p>
    <p>When building from <a href="/en/mozilla-central" title="en/mozilla-central">mozilla-central</a>, use <code>mk_add_options AUTOCONF=autoconf213</code> in your .mozconfig</p>
  </li>
  <li><strong><a href="/en/Mercurial" title="en/Mercurial">Mercurial</a> source control system</strong> (if you're planning to work on post-1.9.0 code). See <a href="/en/Mercurial#Installing" title="en/Mercurial#Installing">Mercurial#Installing</a>.</li>
  <li><strong>To build the Mozilla 1.9.0, 1.9.1, or 1.9.2 branches on a Mac OS X 10.4 build host</strong>, additional packages are required, so run the following command to obtain them:
    <pre>
$ sudo port install python py25-zlib py25-hashlib
</pre>
  </li>
</ul>
<h2 id=".mozconfig_Options_and_Other_Tunables" name=".mozconfig_Options_and_Other_Tunables">.mozconfig options and other tunables</h2>
<p>These options are specific to Mozilla builds for Mac OS X. For a more general overview of build options and the <code>.mozconfig</code> file, see <a href="/en/Configuring_Build_Options" title="en/Configuring_Build_Options">Configuring Build Options</a>. For specific information on configuring to build a universal binary, see <a href="/en/Mac_OS_X_Universal_Binaries" title="en/Mac_OS_X_Universal_Binaries">Mac OS X Universal Binaries</a>.</p>
<ul>
  <li><strong>Compiler:</strong> Firefox releases are no longer built with gcc-4.2. A recent copy of clang is needed.</li>
  <li>See the discussion here: <a class="link-https" href="https://groups.google.com/forum/?fromgroups=#!searchin/mozilla.dev.platform/Switching$20Mac$20OS$20X$20builds$20to$20clang$20for$20Firefox$2017$20/mozilla.dev.platform/GCz92zrldn4/discussion" rel="freelink"> gcc 4.2 - Clang Switch Discussion</a></li>
  <li>There are a some options on where to get clang:
    <ul>
      <li>Newer versions of xcode. The one in xcode 4.1 or newer and the open source 3.1 release should work.</li>
      <li>Following the instructions in the <a class="external" href="http://clang.llvm.org/get_started.html">clang web site</a> for information on how to get it.</li>
      <li>Using some of the package managers (see above).</li>
      <li>Once bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=768879" title="https://bugzilla.mozilla.org/show_bug.cgi?id=768879">768879</a> is fixed, you should be able to download the same packages used by the bots.</li>
    </ul>
    Once clang is installed, make sure it is on the PATH and configure should use it.</li>
</ul>
<p>The following options, specified with <code>ac_add_options</code>, are lines that are intended to be added to your <code>.mozconfig</code> file.</p>
<ul>
  <li><strong>Mac OS X SDK:</strong> This selects the version of the system headers and libraries to build against, ensuring that the product you build will be able to run on older systems with less complete APIs available. Selecting an SDK with this option overrides the default headers and libraries in <code>/usr/include</code>, <code>/usr/lib</code>, and <code>/System/Library</code>. Mac OS X SDKs are installed in <code>/Developer/SDKs</code> during the <a href="#Software_Requirements">Xcode installation</a> by selecting the <strong>Cross Development</strong> category in the installer’s <strong>Customize</strong> screen.
    <pre>
ac_add_options --with-macos-sdk=/path/to/SDK
</pre>
    <p>Official trunk builds now use <code>/Developer/SDKs/MacOSX10.5.sdk</code> but prior to 2009-09-14 used <code>/Developer/SDKs/MacOSX10.4u.sdk</code>. The 1.9.x branches use <code>/Developer/SDKs/MacOSX10.4u.sdk. </code>On the 1.8.0 and 1.8.1 branches, official PowerPC builds use <code>/Developer/SDKs/MacOSX10.2.8.sdk</code>, while official Intel builds use <code>/Developer/SDKs/MacOSX10.4u.sdk</code>.<br />
      Building with <a class="internal" href="/en/DTrace" title="En/DTrace">--enable-dtrace</a> requires the 10.5 SDK: <code>--with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk</code></p>
    <p>Note that some frameworks (notably AppKit) behave differently at runtime depending on which SDK was used at build time. This may be the source of bugs that only appear on certain platforms or in certain builds.</p>
    <p><strong>You will not be able to build Mozilla using the 10.2.8 SDK included in the Xcode 2.4 installer. <span class="comment">If you install Xcode 2.4, please see the <a href="/En/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites#Troubleshooting" title="En/Developer Guide/Build Instructions/Mac OS X Prerequisites#Troubleshooting">Mac OS X Prerequisites#Troubleshooting</a> section for a workaround.</span> Upgrade to Xcode 2.4.1 or newer.</strong></p>
    Use of an SDK is highly recommended, especially when building on Mac OS X 10.3 with Xcode 1.5.</li>
  <li><strong>Deployment Target:</strong> This option selects the minimum OS version that the resulting application will run on. Proper use of this option requires additional support in the code.
    <pre>
ac_add_options --enable-macos-target=version
</pre>
    This option is not recommended. The default for the trunk on all platforms is <code>10.5</code>, while on the 1.9.0-1.9.2 branches it is <code>10.4</code>. The default for PowerPC builds on the 1.8.0 and 1.8.1 branches is <code>10.3</code>, while the default for Intel builds on those branches is <code>10.4</code>. Official builds use these defaults.</li>
  <li><strong><a class="external" href="http://developer.apple.com/releasenotes/DeveloperTools/Prebinding.html">Prebinding</a>:</strong> The Mozilla build system allows you to build an application and libraries that are prebound. This improves application launch time on Mac OS X 10.3.3 and earlier.
    <pre>
ac_add_options --enable-prebinding
</pre>
    The default is to not prebind. Official PowerPC builds are prebound. Official Intel builds are not prebound, as no Intel build will run on any release earlier than 10.4.</li>
  <li><strong>Sample <code>.mozconfig</code>:</strong> This <code>.mozconfig</code> file is suitable to build an Intel version of Minefield (equivalent to Firefox), which will only run on Intel-based Macs running Mac OS X 10.5 or newer:
    <pre>
. $topsrcdir/browser/config/mozconfig
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
ac_add_options --disable-tests</pre>
  </li>
</ul>
<h2 id="Build_Defines" name="Build_Defines">Build defines</h2>
<p>For Mac OS X builds, defines are set up as follows:</p>
<ul>
  <li><code>XP_MACOSX</code> is defined</li>
  <li><code>XP_UNIX</code> is defined</li>
  <li><code>XP_MAC</code> is <strong>not</strong> defined. <code>XP_MAC</code> is obsolete and is slowly being removed from the source tree (see {{ Bug(281889) }}). It was used for CFM (non-Mach-O) builds for the classic (pre-X) Mac OS.</li>
</ul>
<p>This requires care when writing code for Unix platforms that exclude Mac:</p>
<pre>
#if defined(XP_UNIX) &amp;&amp;&nbsp;!defined(XP_MACOSX)
</pre>
<h2 id="Troubleshooting" name="Troubleshooting">Troubleshooting</h2>
<ul>
  <li><strong>Unable to build with GCC</strong>. Apple used to ship a GCC based on vanilla GCC 4.2. They still ship LLVM-GCC (which is also base on GCC 4.2). Mozilla does <strong>not</strong> support building with any GCC 4.2 variant anymore. On OS X, non-Apple (i.e. stock) GCC are also not supported (they don't support blocks), so you must use clang on OS X.</li>
  <li><strong>After installing Xcode 2.4, the build fails in <code>nsLookAndFeel.cpp</code> with:<br />
    <code>error: `kThemeBrushAlternatePrimaryHighlightColor' undeclared (first use this function)</code>.</strong>
    <p>The 10.2.8 SDK included in Xcode 2.4 (build 8K1079) contains a bug that prevents Mozilla from building with that SDK. Apple has been notified of this bug, which is being tracked as Radar 4671592. This bug has been fixed as of Xcode 2.4.1.</p>
  </li>
  <li><strong>QuickTime SDK Update:</strong> If you install or update QuickTime 7, you may also need to install an updated QuickTime SDK, available from “Software Update” in the Apple menu. This update is only needed if Software Update indicates that it is available to you. You will need this update if your build fails because it is unable to find <code>Sound.</code></li>
  <li><strong>Using <em>Fink,</em> you get <code>apt-get: command not found</code>.</strong>
    <p><code>apt-get</code> is not in your <code>$PATH</code>. Close and reopen Terminal and try again. If the error persists, Fink was unable to fully configure itself in your environment. Take these steps:</p>
    <ul>
      <li>If you use the <code>bash</code> shell, the default since Mac OS X 10.3, edit your <code>~/.bashrc</code> file, adding the following line. Don’t neglect the leading period and space.
        <pre>
. /sw/bin/init.sh
</pre>
      </li>
      <li>If you use the <code>tcsh</code> shell, edit your <code>~/.tcshrc</code> file, adding the following line:
        <pre>
source /sw/bin/init.csh
</pre>
      </li>
    </ul>
  </li>
</ul>
<ul>
  <li><strong>Using <em>MacPorts</em> (DarwinPorts), you get <code>port: command not found</code>.</strong>
    <p><code>port</code> is not in your <code>$PATH</code>. Close and reopen Terminal and try again. If the error persists, DarwinPorts was unable to fully configure itself in your environment. Take these steps:</p>
    <ul>
      <li>If you use the <code>bash</code> shell, the default since Mac OS X 10.3, edit your <code>~/.profile</code> (or <code>~/.bash_profile</code> or <code>~/.bash_login</code>, if either exists) file, adding the following line:
        <pre>
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
</pre>
      </li>
      <li>If you use the <code>tcsh</code> shell, edit your <code>~/.tcshrc</code> file, adding the following line:
        <pre>
setenv PATH "/opt/local/bin:/opt/local/sbin:$PATH"
</pre>
      </li>
      <li>After modifying the appropriate file, close and reopen Terminal and try again.</li>
    </ul>
  </li>
  <li><strong>Using Fink with Virex 7.2:</strong> There is a conflict between Fink and Virex 7.2. Both place files within <code>/sw</code>. If you have Virex installed, you will need to upgrade to at least version 7.2.1, as described in the <a class="external" href="http://fink.sourceforge.net/news/index.php#2003-04-16%20Virex%20problem%20resolved">Fink News (2003-04-16)</a>.</li>
  <li><strong>The build stops while building <code>libwidget.rsrc</code> in <code>widget/src/mac</code></strong>
    <p>Delete, or rename <code>~/Library/Preferences/.GlobalPreferences.plist</code>. We're not quite sure what setting in that file is causing this problem. Note that if you remove this file, system preferences such as preferred locales and recent programs will also disappear.</p>
  </li>
  <li><strong>The build complains about missing IDL headers:</strong> Make sure you installed the orbit distribution via Fink's <code>apt-get</code>, and that you edited your <code>.bashrc</code> to source the <code>/sw/bin/init.sh</code> file or your <code>.tcshrc</code> file to source the <code>/sw/bin/init.csh</code> file.</li>
  <li><strong>Can't find <code>dlfcn.h</code> with error <code>nsTraceRefcnt.cpp:68: dlfcn.h: No such file or directory</code></strong>
    <p>Make sure you have the libdl.dylib from Fink. If you install <a class="external" href="http://www.apple.com/downloads/macosx/unix_apps_utilities/bashthegnubourneagainshell.html">bash from Apple</a>, it will provide a copy of libdl.dylib which will not come with the headers (eg. dlfcn.h) needed to compile new programs that use the library, such as Mozilla. The solution is to remove the bash from Apple and install the bash from Fink. (Thanks to <a class="link-mailto" href="mailto:am2stewa@uwaterloo.ca">Alex Stewart</a> for helping us track this down.)</p>
  </li>
  <li>
    <p><strong>Error:&nbsp;Failed to install db46</strong></p>
  </li>
  <li>
    <pre>
Error: Target org.macports.build returned: shell command failed (see log for details)
Error: Failed to install db46
Log for db46 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_db46/main.log
Error: The following dependencies were not installed: python26 db46 gdbm gettext expat libiconv gperf ncurses ncursesw openssl zlib readline sqlite3
Error: Status 1 encountered during processing.
To report a bug, see &lt;http://guide.macports.org/#project.tickets&gt;
</pre>
  </li>
  <li>
    <p>Mac OS X 10.6.5 and newer have removed a file necessary to build db46, which is a prerequisite for some of the MacPorts packages we require. You can get this file by installing the <a class="external" href="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20719 " title="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20719">Java Developer Package for Mac</a>.</p>
  </li>
</ul>
<p><strong>Building with --enable-dtrace fails with </strong><strong>configure: error: dtrace enabled but sys/sdt.h not found</strong><strong>&nbsp;</strong></p>
<p>Make sure you use the 10.5 SDK, not 10.4 as in the default configuration.</p>
<h3 id="Forcing_32-bit_builds">Forcing 32-bit builds</h3>
<p>Currently, 64-bit compilation is the default.&nbsp; If you want to build a 32-bit version of Firefox on Mac OS&nbsp;X, you can append the following lines to your .mozconfig in order to force the build process to produce a 32-bit version of Firefox.</p>
<pre>
CC="clang -arch i386"
CXX="clang++ -arch i386"
ac_add_options --target=i386-apple-darwin9.2.0
ac_add_options --enable-macos-target=10.5

HOST_CC="clang-4.2"
HOST_CXX="clang++-4.2"
RANLIB=ranlib
AR=ar
AS=$CC
LD=ld
STRIP="strip -x -S"
CROSS_COMPILE=1
</pre>
Revert to this revision