User Guide

Mach is the central entry point for most operations that can be performed in mozilla-central.

Command Help

To see an overview of all the available commands, run:

$ ./mach help

For more detailed information on a specific command, run:

$ ./mach help <command>

If a command has subcommands listed, you can see more details on the subcommand by running:

$ ./mach help <command> <subcommand>

Alternatively, you can pass -h/--help. For example, all of the following are valid:

$ ./mach help try
$ ./mach help try fuzzy
$ ./mach try -h
$ ./mach try fuzzy --help

Tab Completion

There are commands built-in to mach that can generate a fast tab completion script for various shells. Supported shells are currently bash, zsh and fish. These generated scripts will slowly become out of date over time, so you may want to create a cron task to periodically re-generate them.

See below for installation instructions:

Bash

$ mach mach-completion bash -f _mach
$ sudo mv _mach /etc/bash_completion.d

Bash (homebrew)

$ mach mach-completion bash -f $(brew --prefix)/etc/bash_completion.d/mach.bash-completion

Zsh

$ mkdir ~/.zfunc
$ mach mach-completion zsh -f ~/.zfunc/_mach

then edit ~/.zshrc and add:

fpath+=~/.zfunc
autoload -U compinit && compinit

You can use any directory of your choosing.

Zsh (oh-my-zsh)

$ mkdir $ZSH/plugins/mach
$ mach mach-completion zsh -f $ZSH/plugins/mach/_mach

then edit ~/.zshrc and add ‘mach’ to your enabled plugins:

plugins(mach ...)

Zsh (prezto)

$ mach mach-completion zsh -f ~/.zprezto/modules/completion/external/src/_mach

Fish

$ ./mach mach-completion fish -f ~/.config/fish/completions/mach.fish

Fish (homebrew)

$ ./mach mach-completion fish -f (brew --prefix)/share/fish/vendor_completions.d/mach.fish

User Settings

Some mach commands can read configuration from a machrc file. The default location for this file is ~/.mozbuild/machrc (you’ll need to create it). This can also be set to a different location by setting the MACHRC environment variable.

For a list of all the available settings, run:

$ ./mach settings

The settings file follows the ini format, e.g:

[alias]
eslint = lint -l eslint

[build]
telemetry = true

[try]
default = fuzzy