This article needs a technical review. How you can help.
This article needs an editorial review. How you can help.
Following this guide you're going to run Gaia inside of a special build of Firefox called Firefox Mulet. This gives you the advantages of having a rapid development cycle, as well as standard web development tools and debuggers available to work with. First of all, you need to have the Gaia repo cloned on your machine and build your own profile. Then, you have to install mulet and run it, passing your Gaia profile as the profile to use.
Le mulet et la mule sont des hybrides statistiquement stériles de la famille des équidés, engendrés par un âne (Equus asinus) et une jument (Equus caballus) - Wikipedia
According to the wiki, "Mulet" comes the french word designating a "mule" and is spelled with only one l!
How can I get it?
As any other program, Mulet can be run from a precompiled package, and this is the easiest way for new users. Experienced ones, obviously, can always compile Mulet on their own to test new features and bugfixes. Except if you use the Single executable method, remember that you won't be able to run Mulet without a Gaia profile.
Single executable
This package was originally shared via Discourse. This is the fastest way to run Mulet for people who don't have knowledge of mulet and/or don't have high speed internet to clone the entire Gaia repository. The package contains Mulet and a precompiled Gaia profile, users don't need to compile anything.
- Download the Archive (94 Mb)
- Extract the archive
Cd
to extracted folder- Give permissions to
start.sh
file through terminalchmod +x
or by right clicking on file > permissions > check allow executing file as program. - Now run the file
./start.sh
or by double clicking it
Note: The executable was tested on Ubuntu 16.04 64 Bit and Arch Linux but it's likely to run on all linux distros.
If you're using Gnome 3 it's likely the script won't run from File. To avoid this, open Edit → Preferences. Select the 'Behavior' tab. Select "Ask each time" or "Run executable text files when they are opened" under "Executable Text Files". Close the window.
Obtain a Gaia profile
As said before, if you don't use the Single executable, obtaining a Gaia profile is necessarily the first step. Only with a Gaia profile, you'll be able to - install before, and then - run Mulet. There are several ways to obtain a Gaia profile.
Download an existing profile
First of all, you can download an existing profile, like this one.
This is the fastest solution, since you'll only need to download around 50 Mb, but you're obviously getting the package as it is.
Get an archive from the repository
If you want more control on the profile you're going to use, you can download an archive of the repository (it will be fast, since you
won't have the git history, but it will require a huge download):
wget https://github.com/mozilla-b2g/gaia/archive/master.zip
unzip master.zip
mv gaia-master gaia
Grab it from Git and compile it
The best way to have an update version of Gaia is to check it out from Github:
$ git clone https://github.com/mozilla-b2g/gaia.git
Next, you need to build a profile:
$ cd ~/gaia $ make
Compile is also the best way to obtain a custom version of Gaia. Further informations can be found in Developing Gaia Overview and Make option reference.
Installing Mulet
Once you have a Gaia profile, you only need to install Mulet itself, and then run it. Also for Mulet there are several ways to get the program working, some are simpler then others, and not all of those solutions are valid for all the OS', so please read carefully the description.
If you're running Microsoft Windows or Mac OS, read the related paragraf or try with Docker.
Docker
Another way to get Mulet is using Docker, a software containerization platform. "Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server" (Read more ...). At least in theory, docker containers can run on all major Linux distributions, Mac OS and on Microsoft Windows. Since this docker image runs Firefox (a GUI application), it's not as portable as other docker images, but it should work at least on Mac OS. Even so, you can try it also an Microsoft Windows.
A Github project was set up to make things easier, report bugs and improve the package. Even this package was originally shared via Discourse.
First of all, obtain a precompiled Gaia profile or create it on your own. If you don't know how to do that, read below.
Ensure you have Docker and docker-compose installed and working.
After that, simply copy the docker-compose.yml
file, and edit it to match your setup.
You should only have to edit the /firefox-profile
volume line to make it work.
Once your docker-compose file is okay, run:
$ docker-compose up
Precompiled Binaries
You can download Mulet precompiled binaries for 64-bit Linux from Mozilla's TaskCluster. To obtain one:
- Visit https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&filter-tier=3&filter-searchStr=mulet
- Look through the list for an entry that says "Mulet Linux x64 opt" with a green "B" next to it. If there aren't any, this means that Mulet is not compiling at present. You can scroll to the bottom and click through to the next page to hopefully find a successful build.
- Click on the green "B" to make a panel at the bottom appear.
- Under the "Job Details" tab, look for "
artifact uploaded: target.tar.bz2
". Click the link to this file to download. - Once the archive has downloaded, extract it somewhere. It doesn't matter where.
- The
firefox-bin
binary in this folder can run mulet. If you want you can add a symlink to it in your path.
Finally, you can launch Mulet:
$ path/to/mulet/firefox-bin --no-remote --devtools --profile ./profile
Compile Mulet on your computer
You can also compile Mulet on your own, from the source. On Taskcluster you can also find a script to automate the process.
Microsoft Windows and Mac OS
Microsoft Windows and Mac OS builds are available at Mozilla Central. The Mulet builds are the packages whose names start with firefox-*
, for example firefox-36.0a1.en-US.mac64.dmg.
Once downloaded, install the Mulet build somewhere safe so that it doesn't overwrite your normal Firefox Nightly build. For example, on Mac OS X, create a new folder inside Applications called "mulet", and drag it into there.
Now run the Mulet build from the command line, passing it your Gaia profile as the profile to use when opening (signified by the -profile
option.) For example, you could run something like this from inside your Applications folder on Mac OS X if you have it installed in there:
./firefox/Contents/MacOS/firefox-bin -no-remote -profile /Users/my-home
You can also try to use Docker, as explained above. Since this docker image runs Firefox (a GUI application), it's not as portable as other docker images, but it should work at least on Mac OS.
Manual Installation on OSX
El Capitan (10.11.6) these are the steps:
- Install Homebrew
- Install Node
- Install Node Version Manager
- Fetch the gaia code
- Make profile
- Make Mulet
- Execute Mulet
Install Homebrew
$ xcode-select --install
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update
Add this line to
export PATH="/usr/local/bin:$PATH"
Install Node
$ brew install node
$ node -v
$ npm -v
Install Node Version Manager
$ brew install nvm
make working directory for nvm:
mkdir ~/.nvm'
open the file:
vim ~/.bash_profile
type "i" on the keyboard so in the left lower corner --Insert-- apears
and add this line:
export NVM_DIR="$HOME/.nvm”' '. "$(brew --prefix nvm)/nvm.sh"
then press "esc" and ":wq" to escape insertion mode and write and quite at the same time.
now check if version is taken with:
nvm ls
if that prints a few lines and the top one looks like this:
-> v4.4.7
system
default -> 4.4.7 (-> v4.4.7)
node -> stable (-> v4.4.7) (default)
stable -> 4.4 (-> v4.4.7) (default)
iojs -> N/A (default)
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.5.0 (-> N/A)
If not in the list:
$ nvm install 4.4.7
Then use it (Should switch to it by default , see install info on your screen ) if it don't :
$ nvm use 4.4.7
then carry on...
Fetch the Gaia code
$ cd Documents - or to the directory you would like to locate the mulet
:gaia 'user'$ git clone https://github.com/your-username/gaia.git && cd gaia ( you have to fork gaia before this step see github doc here Fork a repository )
:gaia 'user'$ git remote add upstream https://github.com/mozilla-b2g/gaia
:gaia 'user'$ npm config set python python2
:gaia 'user'$ make
Make profile
:gaia 'user'$ make profile
Make Mulet
:gaia 'user'$ make mulet
Execute Mulet
:gaia 'user'$ Firefox/Contents/MacOS/firefox-bin -no-remote -profile profile/
Using Mulet
On the display you've got the standard Firefox Toolbox available for debugging your apps, plus an emulation of B2G OS running on the left hand side, and a number of other tools useful to the Gaia context. The controls above the emulator allow you to:
- Choose different screen sizes for the emulator (this is basically Responsive Design View).
- Rotate the emulator screen.
- Turn touch event simulation on and off (if turned off, you can't use the mouse to drag the UI and open apps.)
- Take screenshots.