Download the Fuchsia source code

This guide provides instructions on how to download the Fuchsia source code and set up the Fuchsia development environment on your machine.

The steps are:

  1. Perform a preflight check.
  2. Install prerequisite packages.
  3. Download the Fuchsia source code.
  4. Set up environment variables.
  5. Configure firewall rules (Optional).

1. Perform a preflight check

Fuchsia provides a preflight check tool (ffx platform preflight) that examines your machine and informs you of any issues that may affect building Fuchsia from source on the machine.

Run the following command:


curl -sO && chmod +x ffx-linux-x64 && ./ffx-linux-x64 platform preflight


curl -sO && chmod +x ffx-macos-x64 && ./ffx-macos-x64 platform preflight

2. Install prerequisite packages

Fuchsia requires curl, unzip, and git to be up to date. The version of git needs to be 2.28 or higher.


Install (or update) the following packages:

sudo apt-get install curl git unzip


Install the Xcode command line tools:

xcode-select --install

3. Download the Fuchsia source code

Fuchsia provides a bootstrap script that creates a directory named fuchsia and downloads the Fuchsia source code in that directory.

To download the Fuchsia source, do the following:

  1. Select a directory for downloading the Fuchsia source code, for example:

    cd ~
  2. Run the bootstrap script:

    curl -s "" | base64 --decode | bash

    This script creates the fuchsia directory and downloads the source code.

    If you see the Invalid authentication credentials error during the bootstrapping process, see Authentication error for help.

4. Set up environment variables

Fuchsia recommends that you update your shell profile to include the following actions:

  • Add the .jiri_root/bin directory to your PATH.

    The .jiri_root/bin directory in the Fuchsia source contains the jiri and fx tools that are essential to Fuchsia workflows. Fuchsia uses the jiri tool to manage repositories in the Fuchsia project, and the fx tool helps configure, build, run, and debug Fuchsia. The Fuchsia toolchain requires that jiri is available in your PATH.

  • Source the scripts/ file.

    Though it's not required, sourcing the script enables a number of useful shell functions in your terminal. For instance, it creates the FUCHSIA_DIR environment variable and provides the fd command for navigating directories with auto-completion. For more information, see comments in

To update your shell profile to configure Fuchsia's environment variables, do the following:

  1. Use a text editor to open your ~/.bash_profile file. In our below example we use nano):

    nano ~/.bash_profile
  2. Add the following lines to your ~/.bash_profile file:

    export PATH=~/fuchsia/.jiri_root/bin:$PATH
    source ~/fuchsia/scripts/
  3. Save the file and exit the text editor.

  4. To update your environment variables, run the following command:

    source ~/.bash_profile
  5. Verify that you can run the following commands inside your fuchsia directory without error:

    jiri help
    fx help

5. Configure firewall rules (Optional)

If you're planning on running Fuchsia on Linux, it is advised to run the following command to ensure that Fuchsia device and emulator traffic is allowed:

fx setup-ufw

This script requires sudo to run successfully, and will ask for your password in order to set the appropriate firewall rules to permit Fuchsia-specific traffic.

For more information on fx setup-ufw, see setup-ufw.

Next steps

To build your first Fuchsia system image, see Configure and build Fuchsia.


Authentication error

If you see the Invalid authentication credentials error during the bootstrap process, your ~/.gitcookies file may contain cookies from some repositories in that the bootstrap script wants to check out anonymously.

To resolve this error, do one of the following:

  • Follow the onscreen directions to get passwords for the specified repositories.
  • Delete the offending cookies from the .gitcookies file.

Work on Fuchsia without updating your PATH

The following sections provide alternative approaches to the Set up environment variables section:

Copy the tool to your binary directory

If you don't wish to update your environment variables, but you want jiri to work in any directory, copy the jiri tool to your ~/bin directory, for example:

cp ~/fuchsia/.jiri_root/bin/jiri ~/bin

However, you must have write access to the ~/bin directory without sudo. If you don't, jiri cannot keep itself up-to-date.

Similarly, if you want to use the fx tool without updating your environment variables, provide the fx tool's symlink in your ~/bin directory, for example:

ln -s ~/fuchsia/scripts/fx ~/bin

Alternatively, run the fx tool directly using its path, for example:

./scripts/fx help

In either case, you need jiri in your PATH.