Building a 64-bit Firefox on the Mac

With the release of Snow Leopard, Apple is really starting to push 64-bit programs. Firefox is working towards a 64-bit release but even though the bugs are all resolved, it won’t be shipping anytime soon. Here’s what I did to build a 64-bit LLVM version of Firefox. Important warnings follow the list!

I had MacPorts already installed so I won’t go too much into that. Basically, install the Developer Tools that come on your OS X install disc, and then install MacPorts.

  1. Install a couple of ports we’ll need to get the code and build it:
    sudo port install autoconf213 mercurial libidl
  2. Pull the mozilla-central code. This is the “trunk,” the centre of the development effort. As such, it changes many times a day as bugs are fixed and code is checked in. Despite this, it’s usually pretty stable; automated testing procedures allow developers to roll back any code checkins that cause a problem, although this doesn’t happen for 64-bit builds. Save the code wherever you want to, it’s about 700 MB or so.
    hg clone /Users/you/wherever

    Other repositories include the Gecko 1.91 branch, from which Firefox 3.5.x is built, at or the Gecko 1.92 branch, which will eventually become Firefox 3.6, at However, neither of these branches have the required fixes for a 64-bit build, which is why we’re working with the trunk.

  3. Create a .mozconfig file. This file contains instructions specific to your build, and is where we’re going to be making the 64-bit stuff happen. It must be saved in your home directory, e.g. /Users/you/ and can be called either .mozconfig or mozconfig. The latter will show up in Finder windows. Use your favourite text editor here, I’m not cool enough to use vi or emacs.
    nano ~/.mozconfig
  4. Here are the instructions for our 64-bit, LLVM, Snow Leopard-only build.
    . $topsrcdir/browser/config/mozconfig
    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-dbg
    mk_add_options MOZ_MAKE_FLAGS="-s -j4"
    mk_add_options MOZ_CO_PROJECT=browser
    ac_add_options --enable-optimize
    ac_add_options --enable-application=browser
    ac_add_options --enable-official-branding
    ac_add_options --disable-debug
    ac_add_options --disable-tests
    ac_add_options --disable-installer
    ac_add_options --target=x86_64-apple-darwin10.0.0
    ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.6.sdk
    ac_add_options --enable-macos-target=10.6
    CC="llvm-gcc-4.2 -arch x86_64"
    CXX="llvm-g++-4.2 -arch x86_64"
    STRIP="strip -x -S"
  5. And we’re ready to build. I always pull the latest version of the code just before I build. Again, this command is run from the source directory you created earlier:
    hg pull -u; make -f build

    Go get a coffee; on my 2 GHz MacBook it takes about 25 minutes.

  6. That’s it. To run the new product, you can dig it up in the Finder, or run it from Terminal with this command.
    open obj-ff-dbg/dist/ --args -profilemanager

This process is not without its caveats. Some things you should note:

  • I suggest creating a separate profile for running trunk builds, which is why the open command above runs the profile manager. For the most part you won’t have any problems, but better to be safe than sorry.
  • Unless you can find some 64-bit plugins, you have no Flash, no Quicktime, no Java, etc. Also, some addons that ship with pre-compiled binary code (e.g. Weave) will not work.
  • By building with the --enable-official-branding option, you avoid some of the annoyances of running a development build – the browser identifies itself as Firefox, rather than Minefield. But you must not, under any circumstances, redistribute the program. If you are going to redistribute the program in any way, remove that option from your .mozconfig file. Even if you’re giving a single copy to a friend.
  • The application you just created will only work in Snow Leopard, probably only on a Core 2 Duo processor or better.

3 Replies to “Building a 64-bit Firefox on the Mac”

  1. This is crazy 🙂 You officially converted me into a Firefox MacOS builder addict now 🙂 I’m eager to see them split the trunk into a new release now.

Comments are closed.