May 08, 2012

Gaia Dev Env


Personally, I prefer working with Vagrant. Thanks to @rhelmer, here is his repo b2g-vagrant. It contains a vagrant configure file and puppet file. The README file is quite comprehensive, but please notice, it will download a box file over 10G when you run vagrant up the first time.

SSH directly to VM

Vagrant provides a clean way to develop, however, it is not convenient to connect to VM. I have to go to the vagrant folder and vagrant ssh.

vagrant-proxyssh is a hack to use ssh directly from command line. If you do not like to install it, copy and paste the following words into your ~/.ssh/config


Now, I can use ssh vagrant to connect to VM directly. I also would like to mount remote folder to local machine using sshfs.

The command is quite simple: *sshfs vagrant:/home/vagrant/src/B2G/gaia ~/gaia -oauto_cache,reconnect,defer_permissions,negative_vncache,volname=gaia*

Host Gaia in Apache

Next, let us see how to host gaia in Apache (All the code in this part comes from gaia-hacking, I just make it short)

Install apache2 in VM

sudo apt-get install apache2

Create host config file /etc/apache2/sites-available/

Run the following commands in order

sudo a2enmod expires
sudo a2enmod vhost_alias
sudo a2ensite
sudo apache2ctl graceful

We need to modify Vagrant configure file to visit apache from local machine. Add the next line in Vagrant configure file

config.vm.forward_port 80, 4567

And run vagrant reload. Then we can visit

To see real gaia interface, add following lines in /etc/hosts, and open

For more detail about hacking Gaia, please go to gaia-hacking.


If you are a lazy man like me and you are using Mac, maybe you like to have a working B2G browser. @pauljt provides a build of b2g desktop for Mac OS in mac-b2g-desktop.


All previous work is to prepare the dev env. It is time to meet Gaia.

Go to Gaia folder and modify Makefile. Set DEBUG to 1 and Port to 4567. Then run make. It will do a lot of work and what we need is the profile it generates.

That’s all. Open your browser with the profile we just get /Applications/ -profile ~/gaia/profile

We will get the window just like the image in the beginning in this post.