This guide provides instructions for the following tasks:
Before you start
We recommend you run
ffx platform preflight before you continue.
preflight examines your development machine and informs you of issues that
may affect building Fuchsia from source or running the Fuchsia emulator.
For Linux, run:
curl -sO https://storage.googleapis.com/fuchsia-ffx/ffx-linux-x64 && chmod +x ffx-linux-x64 && ./ffx-linux-x64 platform preflight
For MacOS, run:
curl -sO https://storage.googleapis.com/fuchsia-ffx/ffx-macos-x64 && chmod +x ffx-macos-x64 && ./ffx-macos-x64 platform preflight
The Fuchsia project requires
git to be up-to-date:
For Linux, install or update the following packages:
sudo apt-get install curl git unzip
For macOS, install the Xcode command line tools:
Download Fuchsia source
Fuchsia's bootstrap script creates a
and downloads the content of the Fuchsia source repository to this new
To download the Fuchsia source, do the following:
Select a directory for downloading the Fuchsia source code, for example:
Run the bootstrap script:
curl -s "https://fuchsia.googlesource.com/fuchsia/+/HEAD/scripts/bootstrap?format=TEXT" | base64 --decode | bash
This script creates a
fuchsiadirectory to download the source code. Downloading Fuchsia source can take up to 60 minutes.
If you see the
Invalid authentication credentialserror during the bootstrapping process, see Authentication error for help.
Set up environment variables
Fuchsia recommends updating your shell script to perform the following actions (see Update your shell script for the instructions):
.jiri_root/bindirectory to your
.jiri_root/bindirectory in the Fuchsia source contains the
fxtools are essential to Fuchsia workflows. Fuchsia uses the
jiritool to manage repositories in the Fuchsia project. The
fxtool helps configure, build, run, and debug Fuchsia. The Fuchsia toolchain requires
jirito be available in your
Although it's not required, sourcing the
fx-env.shscript enables useful shell functions in your terminal. For instance, it creates a
FUCHSIA_DIRenvironment variable and provides the
fdcommand for navigating directories with auto-completion (see comments in
fx-env.shfor more information).
Update your shell script
Update your shell script to add Fuchsia's environment variables in your terminal.
Do the following:
Use a text editor to open your
~/.bash_profilefile, for example:
Add the following lines to your
export PATH=~/fuchsia/.jiri_root/bin:$PATH source ~/fuchsia/scripts/fx-env.sh
Save the file and exit the text editor.
To update your environment variables, run the following command:
Verify that you can run the following commands inside your
fuchsiadirectory without error:
See Configure and build Fuchsia in the Getting started guide for the next steps.
If you see the
Invalid authentication credentials error during the bootstrap
~/.gitcookies file may contain cookies from some repositories in
googlesource.com 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
Work on Fuchsia without updating your PATH
The following sections provide alternative approaches to the Update your shell script section:
Copy the tool to your binary directory
If you don't wish to update your environment variables, but you want
work in any directory, copy the
jiri tool to your
~/bin directory, for
cp ~/fuchsia/.jiri_root/bin/jiri ~/bin
However, you must have write access to the
~/bin directory without
jiri cannot keep itself up-to-date.
Add a symlink to your binary directory
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
ln -s ~/fuchsia/scripts/fx ~/bin
Alternatively, run the
fx tool directly using its path, for example:
In either case, you need
jiri in your