Monthly Archives: April 2012

Building B2G (Boot2Gecko) on OSX

I recently attended jsconf in Scottsdale, AZ and we all got Boot2Gecko phones. Yippie! However, after the initial fun wore off of pushing some code to the phone, I wanted to get the desktop emulator running so I could actually develop something. Below is the method I had to use to get it up and running with OSX. It was pretty much a conglomeration of 3 different tutorials, however I hope this will at least be helpful for those folks getting started.


You will need the following installed to get started.

  • Git
  • Mercurial
  • Brew

Getting the code

There are two different pieces needed to get the desktop emulator up and running. First there is Mozilla-central, which is a Mercurial repository of the Mozilla code. This will contain the b2g executable. The second component needed is gaia. This is the user interface for the b2g phone.

Building Mozilla Central

Create a mozconfig

You will need to create a mozconfig file before building. cd into the mozilla-central directory and create a file called “mozconfig”. Then add the following to it and save.


While still in the mozilla-central directory build the source code. Get some coffee, this will be awhile.

When complete you should see a build folder outside of your mozilla-central directory.

Note: There a quite a few prerequisites for building the mozilla source. They are listed here The most common problems are complaining about missing autoconf and YASM. You should be able to get YASM by running “brew install yasm”. This is assuming you have brew installed. For autoconf you will need version 2.13. To get that running you can do the following

Building Gaia

Now that we have mozilla-central working we need to build a profile for gaia. Navigate into the gaia directory that was created when doing a git clone from above. Now we can build with the following command.

A ton of stuff will happen but if everything works out you should have a “profile” folder in your gaia directory.

Running the emulator

Getting the emulator running on OSX was the trickest part. After much trial and error, below was the only sequence that would work for me. I had to fire the first command to open port 6200. Then, I had to run the b2g executable in safe mode while passing the profile generated in the gaia folder.

And… Whooo!


If you don’t need all the features of b2g you can also use Firefox Nightly to debug gaia. This method seems to be faster for quick debugging.


Boot2Gecko is an interesting project from Mozilla. Although in the early stages, I for one am anxious to see how it progresses into a true open mobile platform. Happy Hacking!