Setting up a Tezos baker on a Mac, step by step
A barrier for people to run a Tezos staking node (private Tezos baker) can be the instructions assume advanced technical knowledge like how to install Linux and use the command line.
Luckily for you, this guide will show you how to safely bake your own Tezos using a Ledger Nano hardware wallet and a MacBook.
No command line knowledge is required but you should be comfortable using copy (command c) and paste (command v).
You will need:
- At least 6,000 tez held in your Ledger Nano.
- A Mac or MacBook preferably with at least 16Gb of RAM
- Either a Ledger Nano S or Ledger Nano S +
To speed up synchronisation of the Tezos blockchain we download a rolling snapshot. Head over to https://xtz-shots.io/mainnet/ and download the click the link that says: Download Rolling Snapshot at https://xtz-shots.io/mainnet/
Save the file into your Downloads folder.
Open up your TextEdit or Notes application and copy/paste the name of the file you just downloaded into your notes. For example, mainnet-3051954.rolling You can easily copy this to your clipboard by opening your Downloads folder, clicking once on the file, hit return once, then command c.
Also copy/paste the Block hash from https://xtz-shots.io/mainnet/ (you will need it later)
While this is downloading (nearly 7Gb so may take a while), launch your Terminal. To do this click the small magnifying glass in the top right hand corner near the Day, Date and Time, type in the letters Ter, wait a few seconds and hit return.
We’re going to install OPAM - a package manager for OCaml (which is the programming language Tezos is written in):
A) Copy/paste the following command into your Terminal and hit return.
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
B) Set up OPAM:
opam init --bare
C) Let’s install another package manager named HomeBrew to help us with a few other libraries needed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After it’s finished look for three lines of commands at the end of the output. You should copy/paste them into the terminal one at a time, each time hitting return. The first two lines begin with the word ‘echo’ and the 3rd line begins with the word ‘eval’.
D) We use HomeBrew to install wget which lets your Terminal download files and coreutils which helps prevent an error later on:
brew install wget
brew install coreutils
E) Now we can use wget to download the latest Tezos OPAM packages:
wget https://gitlab.com/tezos/tezos/raw/latest-release/scripts/version.sh
F) Run the following to update current shell environment:
source version.sh
G) Then some opam stuff:
opam switch create for_tezos $ocaml_version
opam depext tezos
export LDFLAGS="-L/opt/homebrew/opt/zlib/lib"
export CPPFLAGS="-I/opt/homebrew/opt/zlib/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig"
H) Now we install Sapling (a privacy technology Tezos has added into the code base):
wget https://gitlab.com/tezos/tezos/-/raw/master/scripts/install_sapling_parameters.sh
sudo chmod +x install_sapling_parameters.sh
Enter your login password if prompted and hit return. If you didn't get any error, skip to step I.
If you get an error of something along the lines of:
mkdir: /share: Read-only file system
then in your Terminal type the following and hit return to know your computer's username:
pwd
open the install_sapling_parameters.sh script you just downloaded:
open -a "TextEdit" install_sapling_parameters.sh
command f to find this line:
ZCASH_PARAMS="${OPAM_SWITCH_PREFIX}/share/zcash-params"
and change it to the following, replacing ComputerUserName with your computer's username (the result returned by the 'pwd' command):
ZCASH_PARAMS="${OPAM_SWITCH_PREFIX}/Users/ComputerUserName/.zcash-params"
Save the file (command s) and close/quit the text editor/
I) The next command installs Tezos and takes about 10 mins, maybe brew some tea while you wait?
opam install octez
J) The next command refreshes the OPAM envirnoment:
eval $(opam env)
K) Open your Terminal config file to set up the path for the Tezos binary:
open ~/.zshrc
Add the following line in it's own separate line in case there's already other stuff there, then save and close the file:
PATH=$PWD/.opam/for_tezos/bin/:$PATH
Close the Terminal window and reopen it to refresh it
(command w closes the window and command n opens a new window)
L) Now we set up the Tezos node to run on the main chain:
octez-node config init --data-dir ~/.tezos-node --network mainnet
M) Import the snapshot we Downloaded earlier copy/pasting the block you copied into your notes after the '--block ' (making sure there's a space after the word --block ), and copy/paste the name of the snapshot file at the end of the line (pay attention to the tilde characters ~ used at the start of ~/.tezos-node and ~/Downloads/ )
octez-node snapshot import --data-dir ~/.tezos-node --block BLnGhZiNatmCFCcBXctnjDdcju8UrdXw8VRWmTcw5Z4dqJoTHVh --in-memory ~/Downloads/mainnet-3051954.rolling
This can take what seems forever but realistically about 30 minutes to an hour. Go for a walk and let it do its thing.
N) Synchronise the node
octez-node run --rpc-addr 127.0.0.1
This step can take an hour or two
O) Check to see if your node has finished synchronising:
octez-client bootstrapped
If it scrolls quickly then it's still catching up but if it simply shows:
Node is bootstrapped
then you're good to go!
P) Download the baker app on your Ledger Nano by going into Ledger Live, Settings (gear icon top right), Experimental Features, turn on Developer Mode
Click on My Ledger at the bottom of the left side bar, confirm on your Ledger device, then in Ledger Live's App Catalog type in 'Tezos baking' and install it. You should also have the Tezos Wallet installed as well (this is where your 6,000 tez need to be stored).
Q) Back in the Terminal, get your Ledger's path by executing:
octez-client list connected ledgers
R) Copy the line which has 'ed25519' towards the end. It may look something like this:
octez-client import secret key ledger_alias "ledger://adventure-synergy-documentary-traversal/ed25519/0h/0h"
S) Register your Ledger for baking (make sure you have the Tezos Wallet open on your Ledger):
Make sure you have the Tezos Wallet app open on your Ledger for this step.
Feel free to change ledger_alias to anything you want (all_one_word_no_spaces).
octez-client register key ledger_alias as delegate
Your rights for baking will start to be ready in a few weeks time.
T) Set up your ledger for baking
Make sure you have the Tezos Baking app open on your Ledger for this step.
octez-client setup ledger to bake for ledger_alias
U) Run the baker daemon but make sure you only run it once!
If you mistakenly run this command in more than one window or more than one computer simultaneously you will forfeit your tez.
Make sure you have the Tezos Baking app open on your Ledger while baking.
Here is the command - use it only once and always be mindful when running it to check for other windows that could be lurking in the background:
octez-baker-PtLimaPt run with local node ~/.tezos-node ledger_alias --liquidity-baking-toggle-vote pass
V) Run the accuser daemon
This accuses bakers who may be trying to double bake:
octez-accuser-PtLimaPt run
It's not strictly necessary to run but you may as well.
W) Check your baking schedule
Copy your tz1 address and search for it in either tzstats.com or tzkt.io.
If you ever need to stop synchronising your node temporarily, control c stops the node gracefully (kepping the data intact) and also stops any running baker.
I will try to keep this up to date and answer any frequently asked questions.
X) Leave your MacBook plugged in and adjust energy settings
Open your System settings, search 'energy', click 'Display energy settings', 'Advanced...' button and turn on 'Prevent automatic sleeping on power adapter when the display is off'.
Thanks to Victor from Nomadic Labs for providing an alternative script for installing Sapling.
If you run into any difficulty don't hesitate to ask me on Twitter or Mastodon.
Previous post: How to Make Money After Buying Crypto