Home Blog CV Projects Patterns Notes Book Colophon Search

Building Firefox 3 on Mac OS X

24 Aug, 2008

First of all read the main build page at http://developer.mozilla.org/en/Mac_OS_X_Build_Prerequisites

I already have the following installed:

Getting Started

Download and install MacPorts 1.6.0 for your platform from http://www.macports.org/install.php

Install packages needed for grabbing and building Firefox:

$ sudo /opt/local/bin/port sync
$ sudo /opt/local/bin/port install mercurial libidl autoconf213

The second stage takes a long time because it builds lots of dependencies. It will stop three times while handling Python. Just keep running the command until everything works. Here's the output I received:

james-gardners-macbook-air:~ james$ sudo /opt/local/bin/port sync
james-gardners-macbook-air:~ james$ sudo /opt/local/bin/port install mercurial libidl autoconf213
--->  Fetching bzip2
--->  Attempting to fetch bzip2-1.0.5.tar.gz from http://www.bzip.org/1.0.5/
--->  Verifying checksum(s) for bzip2
--->  Extracting bzip2
--->  Applying patches to bzip2
--->  Configuring bzip2
--->  Building bzip2 with target all
--->  Staging bzip2 into destroot
--->  Installing bzip2 1.0.5_1
--->  Activating bzip2 1.0.5_1
--->  Cleaning bzip2
--->  Fetching expat
--->  Attempting to fetch expat-2.0.1.tar.gz from http://downloads.sourceforge.net/expat
--->  Verifying checksum(s) for expat
--->  Extracting expat
--->  Configuring expat
--->  Building expat with target all
--->  Staging expat into destroot
--->  Installing expat 2.0.1_0
--->  Activating expat 2.0.1_0
--->  Cleaning expat
--->  Fetching gperf
--->  Attempting to fetch gperf-3.0.3.tar.gz from http://ftp.gnu.org/gnu/gperf
--->  Verifying checksum(s) for gperf
--->  Extracting gperf
--->  Configuring gperf
--->  Building gperf with target all
--->  Staging gperf into destroot
--->  Installing gperf 3.0.3_0
--->  Activating gperf 3.0.3_0
--->  Cleaning gperf
--->  Fetching libiconv
--->  Attempting to fetch libiconv-1.12.tar.gz from http://ftp.gnu.org/gnu/libiconv
--->  Verifying checksum(s) for libiconv
--->  Extracting libiconv
--->  Applying patches to libiconv
--->  Configuring libiconv
--->  Building libiconv with target all
--->  Staging libiconv into destroot
--->  Installing libiconv 1.12_0
--->  Activating libiconv 1.12_0
--->  Cleaning libiconv
--->  Fetching ncursesw
--->  Attempting to fetch ncurses-5.6.tar.gz from http://ftp.gnu.org/gnu/ncurses
--->  Verifying checksum(s) for ncursesw
--->  Extracting ncursesw
--->  Applying patches to ncursesw
--->  Configuring ncursesw
--->  Building ncursesw with target all
--->  Staging ncursesw into destroot
--->  Installing ncursesw 5.6_1
--->  Activating ncursesw 5.6_1
--->  Cleaning ncursesw
--->  Fetching ncurses
--->  Verifying checksum(s) for ncurses
--->  Extracting ncurses
--->  Applying patches to ncurses
--->  Configuring ncurses
--->  Building ncurses with target all
--->  Staging ncurses into destroot
--->  Installing ncurses 5.6_0
--->  Activating ncurses 5.6_0
--->  Cleaning ncurses
--->  Fetching gettext
--->  Attempting to fetch gettext-0.17.tar.gz from http://ftp.gnu.org/gnu/gettext
--->  Verifying checksum(s) for gettext
--->  Extracting gettext
--->  Applying patches to gettext
--->  Configuring gettext
--->  Building gettext with target all
--->  Staging gettext into destroot
--->  Installing gettext 0.17_3
--->  Activating gettext 0.17_3
--->  Cleaning gettext
--->  Fetching python25
--->  Attempting to fetch Python-2.5.2.tgz from http://www.python.org//ftp/python/2.5.2/
--->  Verifying checksum(s) for python25
--->  Extracting python25
--->  Applying patches to python25
--->  Configuring python25
--->  Building python25 with target all libpython2.5.dylib
--->  Staging python25 into destroot
--->  Installing python25 2.5.2_5+darwin_9
--->  Activating python25 2.5.2_5+darwin_9

To fully complete your installation and make python 2.5 the default, please run

    sudo port install python_select
    sudo python_select python25

--->  Cleaning python25
--->  Fetching py25-bz2
--->  Attempting to fetch Python-2.5.2.tar.bz2 from http://www.python.org/ftp/python/2.5.2/
--->  Verifying checksum(s) for py25-bz2
--->  Extracting py25-bz2
--->  Configuring py25-bz2
--->  Building py25-bz2 with target build
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-bz2/work/Python-2.5.2/Modules" && /opt/local/bin/python2.5 setup.py build " returned error 1
Command output: running build
running build_ext
building 'bz2' extension
creating build
creating build/temp.macosx-10.3-i386-2.5
-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include/ -I/opt/local/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c bz2module.c -o build/temp.macosx-10.3-i386-2.5/bz2module.o
unable to execute -DNDEBUG: No such file or directory
error: command '-DNDEBUG' failed with exit status 1

Error: The following dependencies failed to build: py25-bz2 py25-hashlib openssl zlib py25-zlib
Error: Status 1 encountered during processing.
james-gardners-macbook-air:~ james$ sudo /opt/local/bin/port install mercurial libidl autoconf213
Password:
--->  Building py25-bz2 with target build
--->  Staging py25-bz2 into destroot
--->  Installing py25-bz2 2.5.2_0
--->  Activating py25-bz2 2.5.2_0
--->  Cleaning py25-bz2
--->  Fetching zlib
--->  Attempting to fetch zlib-1.2.3.tar.bz2 from http://www.zlib.net/
--->  Attempting to fetch zlib-1.2.3.tar.bz2 from http://www.gzip.org/zlib/
--->  Verifying checksum(s) for zlib
--->  Extracting zlib
--->  Applying patches to zlib
--->  Configuring zlib
--->  Building zlib with target all
--->  Staging zlib into destroot
--->  Installing zlib 1.2.3_1
--->  Activating zlib 1.2.3_1
--->  Cleaning zlib
--->  Fetching openssl
--->  Attempting to fetch openssl-0.9.8h.tar.gz from http://www.openssl.org/source/
--->  Verifying checksum(s) for openssl
--->  Extracting openssl
--->  Applying patches to openssl
--->  Configuring openssl
--->  Building openssl with target all
--->  Staging openssl into destroot
--->  Installing openssl 0.9.8h_0
--->  Activating openssl 0.9.8h_0
--->  Cleaning openssl
--->  Fetching py25-hashlib
--->  Verifying checksum(s) for py25-hashlib
--->  Extracting py25-hashlib
--->  Configuring py25-hashlib
--->  Building py25-hashlib with target build
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-hashlib/work/Python-2.5.2/Modules" && /opt/local/bin/python2.5 setup.py build " returned error 1
Command output: running build
running build_ext
building '_hashlib' extension
creating build
creating build/temp.macosx-10.3-i386-2.5
-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _hashopenssl.c -o build/temp.macosx-10.3-i386-2.5/_hashopenssl.o
unable to execute -DNDEBUG: No such file or directory
error: command '-DNDEBUG' failed with exit status 1

Error: The following dependencies failed to build: py25-hashlib py25-zlib
Error: Status 1 encountered during processing.
james-gardners-macbook-air:~ james$ sudo /opt/local/bin/port install mercurial libidl autoconf213
Password:
--->  Building py25-hashlib with target build
--->  Staging py25-hashlib into destroot
--->  Installing py25-hashlib 2.5.2_0
--->  Activating py25-hashlib 2.5.2_0
--->  Cleaning py25-hashlib
--->  Fetching py25-zlib
--->  Verifying checksum(s) for py25-zlib
--->  Extracting py25-zlib
--->  Configuring py25-zlib
--->  Building py25-zlib with target build
--->  Staging py25-zlib into destroot
--->  Installing py25-zlib 2.5.2_0
--->  Activating py25-zlib 2.5.2_0
--->  Cleaning py25-zlib
--->  Fetching mercurial
--->  Attempting to fetch mercurial-1.0.1.tar.gz from http://www.selenic.com/mercurial/release/
--->  Verifying checksum(s) for mercurial
--->  Extracting mercurial
--->  Configuring mercurial
--->  Building mercurial with target build
--->  Staging mercurial into destroot
--->  Installing mercurial 1.0.1_1
--->  Activating mercurial 1.0.1_1
--->  Cleaning mercurial
--->  Fetching pkgconfig
--->  Attempting to fetch pkg-config-0.23.tar.gz from http://pkg-config.freedesktop.org/releases/
--->  Verifying checksum(s) for pkgconfig
--->  Extracting pkgconfig
--->  Configuring pkgconfig
--->  Building pkgconfig with target all
--->  Staging pkgconfig into destroot
--->  Installing pkgconfig 0.23_0
--->  Activating pkgconfig 0.23_0
--->  Cleaning pkgconfig
--->  Fetching glib2
--->  Attempting to fetch glib-2.16.5.tar.bz2 from http://mandril.creatis.insa-lyon.fr/linux/gnome.org/sources/glib/2.16/
--->  Verifying checksum(s) for glib2
--->  Extracting glib2
--->  Applying patches to glib2
--->  Configuring glib2
--->  Building glib2 with target all
--->  Staging glib2 into destroot
--->  Installing glib2 2.16.5_0+darwin_9
--->  Activating glib2 2.16.5_0+darwin_9
--->  Cleaning glib2
--->  Fetching libidl
--->  Attempting to fetch libIDL-0.8.10.tar.bz2 from http://mandril.creatis.insa-lyon.fr/linux/gnome.org/sources/libIDL/0.8/
--->  Verifying checksum(s) for libidl
--->  Extracting libidl
--->  Applying patches to libidl
--->  Configuring libidl
--->  Building libidl with target all
--->  Staging libidl into destroot
--->  Installing libidl 0.8.10_0
--->  Activating libidl 0.8.10_0
--->  Cleaning libidl
--->  Fetching autoconf213
--->  Attempting to fetch autoconf-2.13.tar.gz from http://ftp.gnu.org/gnu/autoconf
--->  Verifying checksum(s) for autoconf213
--->  Extracting autoconf213
--->  Configuring autoconf213
--->  Building autoconf213 with target all
--->  Staging autoconf213 into destroot
--->  Installing autoconf213 2.13_0
--->  Activating autoconf213 2.13_0
--->  Cleaning autoconf213

Now get the Firefox source code using Mercurial:

hg clone http://hg.mozilla.org/mozilla-central

To build it you will need to modify your path to include the MacPorts software:

export PATH=$PATH:/opt/local/bin

Now you can start the build:

cd mozilla-central
make -f client.mk build

This command will run for hours but when it is finished you will have a Firefox build.

Run the build in a terminal like this (you have to close any existing Friefox browsers though):

./obj-ff/dist/bin/firefox-bin

Run the debug build by clicking on the MinefieldDebug icon in the same directory.

And here it is running:

Copyright James Gardner 1996-2020 All Rights Reserved. Admin.