06.1 · Guide
Install the toolchain
Node, Git, Foundry, and the compute CLI on macOS, Windows, and Linux.
What has to be installed
Every later guide assumes four tools: Git, Node.js 20 or newer, Foundry’s cast and forge, and the 0G compute CLI. Storage-node operators also need Rust. Install Rust in the storage-node guide, not here, unless you already know you are mining.
Official installers move. If a command on this page disagrees with the installer you just opened, follow the installer and keep the version checks below. Foundry’s book is book.getfoundry.sh/getting-started/installation. Node’s package is the LTS line. The compute CLI is the global binary from @0gfoundation/0g-compute-ts-sdk.
Install on your OS
Run the block that matches your machine. Stop after a block if the version check fails, fix PATH, and only then continue. Do not chain them into one pasted script the first time.
When a command is not found
- macOS: a new terminal picks up ~/.foundry/bin and the Homebrew shellenv line. zsh reads ~/.zprofile at login and ~/.zshrc for interactive shells. If you wrote the brew line only to ~/.zprofile, open a login shell or also source it.
- Windows: winget updates the user PATH for future processes. The window that ran winget often still has the old PATH. Close it. Windows Terminal can also be holding an old session.
- Windows: npm’s global bin is not always on PATH. npm prefix -g prints the folder. The CLI shim lives in that folder.
- Linux: installing Node from apt and from nvm at the same time produces two node binaries. which node should point at ~/.nvm. If apt’s Node is older than 20, do not use it for the compute CLI.
- Linux: if Foundry says it cannot write ~/.foundry, you ran the installer with sudo. Run it again as your user.