Skip to main content

Installation

In this chapter, we will see how to install Tezos from the source with Unbuntu and macOS.

Build from source (Ubuntu)

Fisrt install the libraries that Tezos is dependent on

sudo apt update && sudo apt install -y rsync git m4 build-essential patch unzip bubblewrap wget pkg-config libgmp-dev libev-dev libhidapi-dev

Type your password when prompted. [sudo] password for username:

Install Rust

Compiling Tezos requires, the Rust compiler and the Cargo package manager, to be installed.

cd $HOME
wget https://sh.rustup.rs/rustup-init.sh
chmod +x rustup-init.sh
./rustup-init.sh --profile minimal --default-toolchain 1.44.0 -y
source $HOME/.cargo/env

Install Zcash Parameters

Tezos binaries require the Zcash parameter files to run.

wget https://raw.githubusercontent.com/zcash/zcash/master/zcutil/fetch-params.sh
chmod +x fetch-params.sh
./fetch-params.sh

Install OPAM

wget https://github.com/ocaml/opam/releases/download/2.0.3/opam-2.0.3-x86_64-linux
sudo cp opam-2.0.3-x86_64-linux /usr/local/bin/opam
sudo chmod a+x /usr/local/bin/opam

Get sources

git clone https://gitlab.com/tezos/tezos.git
cd tezos
git checkout latest-release

Install Tezos dependencies

opam init --bare
make build-deps

Answers the prompts with 'N' then 'y'.

You may also be prompted for your sudo password.

You may encounter a "switch" error, but you can ignore it. You may encounter failures in the processes of the make build-deps command. In that case, just re-type the command to re-initiate.

Compile sources

eval $(opam env)
make

You can quickly check the correct installations of some files:

./tezos-client --version
./tezos-admin-client --version

The commands should return appropriate versions.

Build from source (MacOs)

Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install the libraries that Tezos is dependent on

brew install hidapi libev

On Catalina you may see the following error, if you have xcode installed: โ€œxcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun"

If this is the case, then run the following command to update your xcode, then install and restart the terminal.

xcode-select --install

Install Rust

Compiling Tezos requires the Rust compiler and the Cargo package manager to be installed.

curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

Get sources

git clone https://gitlab.com/tezos/tezos.git
cd tezos
git checkout latest-release

Install the OPAM

brew install gpatch
brew install opam
opam init
opam update
eval $(opam env)

Install Tezos dependencies

cd tezos
make build-deps

You may encounter a "switch" error: You can ignore it. You may encounter failures in the processes of the make build-deps command. In that case, just re-type the command to re-initiate.

Compile sources

eval $(opam env)
make

You can quickly check the correct installations of some files:

./tezos-client --version
./tezos-admin-client --version

Other installations methods

To have a pre-built binary distributions for some popular Linux distros refer to

https://tezos.gitlab.io/introduction/howtoget.html#setting-up-the-development-environment-from-scratch

To use a Docker installation refer to

https://tezos.gitlab.io/introduction/howtoget.html#using-docker-images

To easily setup a node and a baker refer to

https://github.com/serokell/tezos-packaging/blob/master/docs/baking.md

References

[1] https://tezos.gitlab.io/introduction/howtoget.html#setting-up-the-development-environment-from-scratch

[2] https://www.coincashew.com/coins/overview-xtz/guide-how-to-setup-a-baker/install-a-tezos-node

[3] https://tezbaker-io.medium.com/tezos-mainnet-setting-up-home-baking-on-a-mac-c7730a68c41d