No description, website, or topics provided.
C++ Dart C Python Java Shell Other
Latest commit f842de0 Sep 29, 2016 @jamesr jamesr Update path to gsutil binary in depot_tools
This moved in depot_tools, which auto-updates.

Review URL: .
Failed to load latest commit information.
apps Move mojo/public/c/gpu/* to mojo/public/c/include. Aug 11, 2016
benchmarks Change the canonical way to include the C system headers to <mojo/sys… Aug 9, 2016
build Add a mojo module_arg to specify where gtest is. Aug 16, 2016
crypto Roll base to 9e74307b276b2f9988005c0e97e85ee222586f79. Jun 9, 2016
device/udev_linux Ozone integration from chromium @ Aug 18, 2015
docs Initial doc for the mojom protocol. Sep 2, 2016
examples Remove Python content handler and cython, roll to mojo/public@0b55167 Sep 28, 2016
fusl Roll buildtools to 3780bc523aad1d68a5bd00e05c453a80b2ba0b35 Jun 20, 2016
gin Roll base to 5e00da80f6adb7082d1c0e88d3274cf87cc43bc5 and tonic to f7… May 31, 2016
gpu Move mojo/public/c/gpu/* to mojo/public/c/include. Aug 11, 2016
mojo Update path to gsutil binary in depot_tools Sep 29, 2016
sandbox Roll base to 5e00da80f6adb7082d1c0e88d3274cf87cc43bc5 and tonic to f7… May 31, 2016
sdk_build Change the canonical way to include the C bindings headers to <mojo/b… Aug 10, 2016
services Remove Python content handler and cython, roll to mojo/public@0b55167 Sep 28, 2016
shell Update for new location of gpu mojo/public headers and roll mojo/public Sep 28, 2016
skia Roll skia to 8cc209111876b7c78b5ec577c9221d8ed5e21024 May 26, 2016
testing Roll base to 0032c8e1a72eb85d947d8df8de503caa62b4d0a8. Jun 8, 2016
third_party Remove Python content handler and cython, roll to mojo/public@0b55167 Sep 28, 2016
tools Rust: Add SHA1 verification for binaries on sync Jul 14, 2016
ui Change the canonical way to include the C system headers to <mojo/sys… Aug 9, 2016
.clang-format Update from Dec 3, 2014
.gitattributes Clone of chromium aad1ce808763f59c7a3753e08f1500a104ecc6fd refs/remot… Oct 3, 2014
.gitignore Remove Python content handler and cython, roll to mojo/public@0b55167 Sep 28, 2016
.gn Roll angle to 46ccef1992a8ede16a596c3dd73cff13c047267d and enable gn … Jan 20, 2016
AUTHORS public May 16, 2015 Remove Python content handler and cython, roll to mojo/public@0b55167 Sep 28, 2016
DEPS Update for new location of gpu mojo/public headers and roll mojo/public Sep 28, 2016
DEPS.nacl Fold DEPS.nacl into DEPS Apr 6, 2015
LICENSE Clone of chromium aad1ce808763f59c7a3753e08f1500a104ecc6fd refs/remot… Oct 3, 2014
OWNERS Add * to root OWNERS Oct 21, 2014 Nuke NaCl SFI, part 1. Jun 14, 2016 Remove //third_party/wtl. Nov 11, 2015 Pull PRESUBMIT test mocks out of // Dec 12, 2014 Whitespace fix. Jun 6, 2016
WATCHLISTS Remove stale sky entry in mojo WATCHLISTS. Nov 6, 2015
codereview.settings Submit tryjobs automatically on upload May 12, 2015
mojoconfig Allow to set a fixed port for the development server. Aug 25, 2015


Mojo is a collection of interprocess communication technologies, protocols and a runtime for creating applications and services that are composable while being loosely coupled. It simplifies the creation of fully asynchronous component-based systems and provides guarantees so that components made by different vendors and in different programming languages can interoperate.

Set-up and code check-out

The instructions below only need to be done once. Note that a simple "git clone" command is not sufficient to build the source code because this repo uses the gclient command from depot_tools to manage most third party dependencies.

  1. Download depot_tools and make sure it is in your path.
  2. [Googlers only] Install Goma in ~/goma.
  3. Create a directory somewhere for your checkout (preferably on an SSD), cd into it, and run the following commands:
$ fetch mojo # append --target_os=android to include Android build support.
$ cd src

# Or if you plan to build for Android.
$ ./build/

$ mojo/tools/ gn

The fetch mojo command does the following:

  • creates a directory called 'src' under your checkout directory
  • clones the repository using git clone
  • clones dependencies with gclient sync installs any packages needed to build, then mojo/tools/ gn runs gn args and configures the build directory, out/Debug.

If the fetch command fails, you will need to delete the src directory and start over.

Adding Android bits in an existing checkout

If you configured your set-up for Linux and now wish to build for Android, edit the .gclient file in your root Mojo directory (the parent directory to src.) and add this line at the end of the file:

target_os = [u'android',u'linux']

Bring in Android-specific build dependencies:

$ build/

Pull down all of the packages with this command:

$ gclient sync

Update your checkout

You can update your checkout like this. The order is important. You must do the git pull first because gclient sync is dependent on the current revision.

# Fetch changes from upstream and rebase the current branch on top
$ git pull --rebase
# Update all modules as directed by the DEPS file
$ gclient sync

You do not need to rerun gn gen out/Debug - ninja does so automatically each time you build. You might need to rerun mojo/tools/ gn if the GN flags have changed.

Build Mojo


Build Mojo for Linux by running:

$ ninja -C out/Debug -j 10

You can also use the script for building. This script automatically calls ninja and sets -j to an appropriate value based on whether Goma (see the section on Goma below) is present. You cannot specify a target name with this script.

mojo/tools/ gn
mojo/tools/ build

Run a demo:

out/Debug/mojo_shell mojo:spinning_cube

Run the tests:

mojo/tools/ test

Run the benchmarks:

mojo/devtools/common/mojo_benchmark mojo/tools/data/benchmarks

Create a release build:

mojo/tools/ gn --release
mojo/tools/ build --release
mojo/tools/ test --release


To build for Android, first make sure that your checkout is configured to build for Android. After that you can use the mojob script as follows:

$ mojo/tools/ gn --android
$ mojo/tools/ build --android

The result will be in out/android_Debug. If you see javac compile errors, make sure you have an up-to-date JDK

Goma (Googlers only)

If you're a Googler, you can use Goma, a distributed compiler service for open-source projects such as Chrome and Android. If Goma is installed in the default location (~/goma), it will work out-of-the-box with the gn, build workflow described above.

You can also manually add:

use_goma = true

at the end of the file opened through:

$ gn args out/Debug

After you close the editor gn gen out/Debug will run automatically. Now you can dramatically increase the number of parallel tasks:

$ ninja -C out/Debug -j 1000

Official builds

Official builds for android generate a signed Mojo Shell intended for distribution. You normally should not need to produce one. If you have any questions, reach out to

Run Mojo Shell

Devtools mojo_run is a universal shell runner abstracting away the differences between running on Linux and Android.

Having built Mojo as described above, a demo app can be run as follows:

mojo/devtools/common/mojo_run  # Linux
mojo/devtools/common/mojo_run --android  # Android

Development server

Whenever mojo_run is run, a development server is set up according to the config file. The server runs on your machine, serving the locally built apps, but appears to the shell under the host.

You can ignore the config file and skip spawning the local server (for example, in order to use apps at the actual web host) by passing --no-config-file to mojo_run.

More examples

Some applications can be run directly from the source tree. The development server serves the src directory, allowing to refer to these apps. For instance, this command serves a dart Mojo app from the source at examples/dart/device_info/main.dart:

mojo/devtools/common/mojo_run [--android]

Some applications implement ViewProvider and are run embedded in a view. To run these, you can pass the app url using the --embed flag:

mojo/devtools/common/mojo_run --embed mojo:moterm_example_app [--android]

which is a shorthand for:

mojo/devtools/common/mojo_run "mojo:launcher mojo:moterm_example_app"

For additional information on mojo_run refer to the built-in help and the documentation. You can also request more information on what the tool is doing for you by passing the --verbose flag.

Debugging, tracing, profiling

Devtools mojo_debug allows you to interactively inspect a running shell, collect performance traces and attach a gdb debugger.

For additional information refer to the built-in help and the documentation.

Android set-up


For the Android tooling to work, you will need to have adb in your PATH. For that, you can either run:

source build/android/

each time you open a fresh terminal, or add something like:

export PATH="$PATH":$MOJO_DIR/src/third_party/android_tools/sdk/platform-tools

to your ~/.bashrc file, $MOJO_DIR being a path to your Mojo checkout.


The device has to be running Android 5.0 (Lollipop) or newer.

Many features useful for development (ie. streaming of the shell stdout when running shell on the device) will not work unless the device is rooted and running a userdebug build. For Googlers, follow the instructions at this link.

Running manually on Linux

If you wish to, you can also run the Linux Mojo shell directly with no wrappers:

./out/Debug/mojo_shell out/Debug/spinning_cube.mojo


With git you should make all your changes in a local branch. Once your change is committed, you can delete this branch.

Create a local branch named "mywork" and make changes to it.

  cd src
  git new-branch mywork
  vi ...

Commit your change locally. (this doesn't commit your change to the SVN or Git server)

  git commit -a

Fix your source code formatting.

$ git cl format

Upload your change for review.

$ git cl upload

Respond to review comments.

See Contributing code for more detailed git instructions, including how to update your CL when you get review comments. There's a short tutorial that might be helpful to try before making your first change: C++ in Chromium 101.

To land a change after receiving LGTM:

$ git cl land


Our waterfall continuously builds and tests the code. Don't break the build!


One of the bots, Mojo Linux Perf runs a suite of benchmarks and uploads the results to the performance dashboard. You can browse the results here, putting mojo_benchmarks as the "test suite".

Automated alerts about performance regressions are sent to

For examples of interesting sets of graphs see:

Development Tools

These are some helpful tools for use during development.

Atom IDE plugins

Here are some useful plugins for Atom IDE during Mojo development.

  • language-mojom: provides syntax highlighting for *.mojom files.
  • clang-format: auto-formats C and C++ code in the editor (make sure to configure the path to the executable in the plugin settings).

Vim plugins

The //tools/vim directory contains the following plugins, refer to each script for installation instructions.

  • mojom: provides syntax highlighting for *.mojom files.
  • clang_format.vim: binds keyboard shortcuts to invoke clang-format.
  • filetypes.vim: provides syntax highlighting for *.gyp, *.gypi, and DEPS files.
  • ninja-build.vim: binds keyboard shortcuts to invoke the ninja build tool.

Address Sanitizer (ASAN)

Use ASAN to help find misuse of heap memory such as use-after-free errors.

$ mojo/tools/ gn --asan
$ mojo/tools/ build --asan

Use //tools/valgrind/asan/ to decode stack traces when ASAN detects an error at runtime.

This tool is not supported on Android.

Android Stack Parser

Use //mojo/devtools/common/android_stack_parser/stack to decode stack traces from Mojo programs running on Android.

Make sure to include the lines containing Caching mojo app XXX at YYY which are printed while the program starts up so that the stack tool can locate the necessary symbols on the host machine.