This guide provides instructions for the following tasks:
Fuchsia's bootstrap script requires Python, cURL, unzip, and Git to be up-to-date.
Install or update the following packages:
sudo apt-get install build-essential curl git python unzip
Do the following:
Install the Xcode command line tool:
xcode-select --install
Install the latest version of Xcode{:.external}.
Fuchsia's bootstrap script creates a fuchsia
directory and downloads the content of the Fuchsia source repository to this new directory.
To download the Fuchsia source, do the following:
Go to the directory where you want to create your fuchsia
directory, for example:
cd ~
Note: All examples and instructions in fuchsia.dev
use ~/fuchsia
as the root directory of the Fuchsia project.
Run the bootstrap script:
curl -s "https://fuchsia.googlesource.com/fuchsia/+/master/scripts/bootstrap?format=TEXT" | base64 --decode | bash
Downloading may take up to 60 minutes.
To learn how the Fuchsia source code is organized, see Source code layout.
If you see the Invalid authentication credentials
error during the bootstrap process, your ~/.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:
.gitcookies
file.Setting up Fuchsia environment variables requires the following:
.jiri_root/bin
directory to your PATH
.scripts/fx-env.sh
file.The .jiri_root/bin
directory in the Fuchsia source contains the jiri
{:.external} and fx
tools, which are essential to Fuchsia workflows. Fuchsia uses the jiri
tool to manage multiple repositories in the Fuchsia project. The fx
tool helps configure, build, run, and debug Fuchsia. The Fuchsia toolchain requires jiri
to be available in your PATH
.
Additionally, sourcing the fx-env.sh
script enables useful shell functions in your terminal. For instance, it creates a FUCHSIA_DIR
environment variable and provides the fd
command for navigating directories with auto-completion. See comments in fx-env.sh
for details.
Update your shell script to automatically set up Fuchsia environment variables in your terminal.
The following steps use a bash
terminal as an example:
Use a text editor to open your ~/.bashrc
file:
vim ~/.bashrc
Add the following lines your ~/.bashrc
file and save the file:
Note: If your Fuchsia source code is not located in the ~/fuchsia
directory, replace ~/fuchsia
with your Fuchsia directory.
export PATH=~/fuchsia/.jiri_root/bin:$PATH source ~/fuchsia/scripts/fx-env.sh
Update your environment variables:
source ~/.bashrc
You can now run jiri
and fx
in any directory.
Run the following commands in any directory and confirm that these commands print a usage guide for the tool:
jiri help
fx help
The following sections provide alternative approaches to the Update your shell script section.
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:
Note: If your Fuchsia source code is not located in the ~/fuchsia
directory, replace ~/fuchsia
with your Fuchsia directory.
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:
Note: If your Fuchsia source code is not located in the ~/fuchsia
directory, replace ~/fuchsia
with your Fuchsia directory.
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
.
For the next steps, see Configure and build Fuchsia in the Getting started guide.