Gaia Hacks – Part 1

Following are some useful commands that i came across  while contributing to OPEN SOURCE  to  Mozilla  (Firefox OS)

All commands are used on Linux system (Ubuntu 14.04)

Hack – 1.  How to Run Gaia in your nightly browser

Install nightly browser in your system

  • sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa
  • sudo apt-get update
  • sudo apt-get install firefox-trunk

Getting the Source code

To get the source code for Gaia, fork us on GitHub and then clone your fork using git.This repo is around 1GB so have patience while clonning the repo.

$ git clone

Now go to your gaia directory.

cd gaia

After the above is complete, you are ready to make your local Gaia profile. Inside the gaia directory, which you should be in now, run:

DEBUG=1 make

The process above is going to do a bunch of things and the first time you run it, it is going to take some time so my suggestion is, take a break and make yourself some coffee. Once the above has completed the last line of output should be something like:

Profile Ready: please run [b2g|firefox]
-profile /Users/schalkneethling/mozilla/projects/gaia/profile

Now that we have our profile and nightly browser, let’s join the two. Open up a terminal (command line) and enter the following:This will open nightly browser and gaia running in browser 🙂

/path/to/nightly-browser -profile /path/to/profile

Something like this:-

rishav@rishav:~$ /usr/bin/firefox-trunk -profile /home/rishav/mozilla/gaia/profile-debug/ -no-remote
Screenshot from 2014-06-01 01:19:30

Hack – 2.  How to Update your forked gaia repo

Now another important thing.There is lots of changes takes place daily in master branch of mozilla-b2g/gaia repo.It’s not necessary for running gaia but it’s good if you update your forked gaia repo daily so that you will get updated with new changes.

git remote add upstream

Then run ‘git remote -v‘  you should see four lines, two called ‘origin’ (your fork) and two called ‘upstream’ (the mozilla-b2g original repo).

then, fetch from upstream repo:

git fetch upstream

Wait until gets all the changes, then go into your master branch (if you are not) and update it with the upstream master branch

git checkout master

git merge upstream/master

Once you have done that do ‘git push – -all‘  to push the updates into your fork (origin).

Hack – 3.  How to Run gaia unit-test

First of all what is unit test? 🙂

As part of the Gaia/B2G source code, we have  various unit tests available to run, for testing different aspects of Gaia and B2G.

Install nodejs and npm in your system.

The first thing you will need to do is open two terminals and go into main gaia directory in both terminals.

Now we need to set an environment variable to point to nightly firefox into both terminals.

We can do this by following command :

export FIREFOX=/path/to/your/nightly/firefox

Basically the FIREFOX environment variable has to point to nightly firefox binary.

Now after done with this, run following command in one of the terminal:


This will download a bunch of things and open the nightly browser.Now we are ready to run the unit test.

Now go to other terminal and run this command.This will run the unit test for SMS app.

make test-agent-test APP=sms

You can do this with any app whether it is contact, setting, calendar, sms etc….

If you run   ‘make test-agent-test‘    it will run unit test for all the app i.e complete gaia.

Best thing, once you start the unit test for any app (say sms), then if you make any changes in the code related to that app it will run the unit-test automatically and also very quickly 🙂

If you feel any problem then ping on irc channel #gaia or #b2g or join the gaia mailing list. You can ping me too on .

More blogs are coming on this till then

Happy Hacking  🙂





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s