5/5
To begin developing with Noir, the zero-knowledge proof language, you'll first need to set up your environment by installing Nargo (Noir's command-line interface and package manager) and a compatible proving backend. This guide will walk you through installing Nargo and Barretenberg, a popular proving backend developed by Aztec Labs, along with a necessary dependency, `jq`. ## Installing Nargo: The Noir CLI and Package Manager Nargo is the primary tool for working with Noir. The recommended way to install Nargo is by using `noirup`, a script that manages Noir installations. 1. **Install `noirup`** First, you'll need to install `noirup`. Open your terminal and execute the following command, which downloads and runs the official installation script from the `noir-lang/noirup` GitHub repository: ```bash curl -L https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash noirup ``` This command fetches the script and pipes it to `bash` for execution. The `noirup` at the end is an argument passed to the installation script itself. Upon successful execution, the script will add `noirup` to your system's PATH, typically by modifying your shell's configuration file (e.g., `~/.zshrc` for Zsh, `~/.bashrc` or `~/.bash_profile` for Bash). 2. **Update Your Shell Configuration** For the changes to your PATH to take effect in your current terminal session, you need to "source" your shell's configuration file. If you are using Zsh (as is common on modern macOS), run: ```bash source ~/.zshrc ``` If you are using Bash, the command would typically be `source ~/.bashrc` or `source ~/.bash_profile`. This step ensures that your terminal can find the `noirup` command. Alternatively, you can open a new terminal window. 3. **Install Nargo using `noirup`** With `noirup` installed and available in your PATH, you can now install Nargo. Simply run: ```bash noirup ``` This command will download and install the latest stable version of Nargo, which includes the Noir compiler and other necessary binaries. 4. **Verify Nargo Installation** To confirm that Nargo has been installed correctly and to check its version, use the `--version` flag: ```bash nargo --version ``` You should see output similar to the following, indicating the versions of Nargo and the Noir compiler (`noirc`): ``` nargo version = 1.0.0-beta.3 noirc version = 1.0.0-beta.3+ceea1986628197bd117d147f6a07f98d21030a (git version hash: ceea1986628197bd117d147f6a07f98d21030a, is dirty: false) ``` Ensure this version aligns with the latest recommended version or the version specified in any tutorials you are following (e.g., `v1.0.0-beta.3` as per the Noir documentation at the time of some guides). 5. **Explore Nargo Commands** Nargo offers a suite of commands for managing and interacting with your Noir projects. To see all available commands, run: ```bash nargo --help ``` Key commands you will frequently use include: * `check`: Checks a local package and its dependencies for correctness. * `fmt` (or `format`): Formats Noir source files within a workspace. * `compile`: Compiles your Noir program. * `new`: Creates a new Noir project in a new directory. * `init`: Creates a new Noir project in the current directory. * `execute`: Executes a circuit to calculate its return value, generating the witness. * `debug`: Executes a circuit in debug mode for troubleshooting. * `test`: Runs any tests defined for your program. Other commands like `lsp` (for Language Server Protocol support) or `generate-completion-script` are available but may not be immediately necessary for initial development. ## Installing Barretenberg: Your Proving Backend After successfully installing Nargo, you need a proving backend to generate and verify proofs for your Noir programs. We will install Barretenberg, a C++ proving system. 1. **Install `bbup` (Barretenberg Up)** Similar to `noirup` for Nargo, Barretenberg provides `bbup` for managing its installations. To install `bbup`, use the following command: ```bash curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/refs/heads/master/barretenberg/bbup/install | bash bbup ``` This script downloads and executes the `bbup` installer. A crucial feature of this script is that it automatically queries your installed Nargo version and then downloads and installs a compatible version of the Barretenberg binaries (`bb`). You will see output indicating this process: ``` Querying noir version from nargo Resolved noir version 1.0.0-beta.3 from nargo Getting compatible barretenberg version for noir version 1.0.0-beta.3 Resolved to barretenberg version 0.82.2 Installing to /Users/yourusername/.bb Installed barretenberg to /Users/yourusername/.bb ``` The `bbup` installer will also attempt to add its installation directory (e.g., `~/.bb`) to your PATH. 2. **Update Your Shell Configuration (If Necessary)** If the `~/.bb` directory was newly added to your PATH by the `bbup` installer, you'll need to source your shell configuration file again for the `bb` command to be accessible in your current session: ```bash source ~/.zshrc ``` (Or the equivalent for your shell, like `source ~/.bashrc`). If `bbup` was already in your PATH from a previous installation, or if your PATH was already configured to include `~/.bb`, this step might not be strictly necessary for `bbup` itself. However, because the `bbup` installation script *also* installs `bb` (Barretenberg), sourcing ensures the `bb` command is found. In most cases, the `bbup` installation script handles the Barretenberg (`bb`) download and installation automatically, so you won't need to run `bbup` manually to install `bb` after sourcing. 3. **Verify Barretenberg (`bb`) Installation** To check that Barretenberg (`bb`) is installed correctly and to see its version, run: ```bash bb --version ``` The output should display the version that `bbup` determined to be compatible with your Nargo installation, for example: ``` v0.82.2 ``` This confirms that the Barretenberg backend is ready. 4. **Explore Barretenberg (`bb`) Commands** The Barretenberg CLI (`bb`) provides several subcommands for interacting with the proving system. To view them, use: ```bash bb --help ``` Key subcommands include: * `check`: A debugging tool for witness satisfaction against constraints. * `gates`: Constructs a circuit from bytecode and returns its gate count. * `prove`: Generates a proof for a given circuit and witness. * `write_vk`: Writes the verification key of a circuit to a file. * `verify`: Verifies a proof off-chain. * `write_solidity_verifier`: Generates a Solidity smart contract that can verify proofs on-chain. The help output can be extensive due to numerous options for each subcommand. ## Installing `jq`: A Barretenberg Dependency Barretenberg requires `jq`, a command-line JSON processor, to parse JSON files during its operation. 1. **Identify the Need for `jq`** At the time of writing, `jq` is a necessary runtime dependency for Barretenberg. If `jq` is not installed, you may encounter errors when Barretenberg attempts to process JSON data. 2. **Install `jq`** The installation method for `jq` varies by operating system. For macOS, the recommended method is using Homebrew. * **Install Homebrew (if you don't have it):** Visit `brew.sh` and follow the instructions. The installation command is typically: ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` * **Install `jq` using Homebrew:** Once Homebrew is installed, you can install `jq` with: ```bash brew install jq ``` For other operating systems or installation methods, refer to the official `jq` download page at `jqlang.org/download/`. It's often advisable to proceed with your Noir development workflow after installing Nargo and Barretenberg. If you encounter an error message specifically stating that `jq` is missing, then proceed to install `jq`. This ensures you only install it if actively required by your setup and workflow. With Nargo, Barretenberg, and `jq` installed, your development environment is now set up. You are ready to create your first Noir project and explore the world of zero-knowledge proofs.
A foundational primer to Your First Steps with Noir: Environment Setup - This lesson details installing Nargo (Noir's CLI), Barretenberg (proving backend), and the `jq` utility. Set up your essential toolkit to begin developing zero-knowledge applications using Noir.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Noir syntax
Create a witness, a proof, and Solidity verifier contracts
Use the Poseidon commitment scheme
Create ZK circuits and build a full ZK protocol
ZK Merkle trees and hashing in Noir
Verify signatures without revealing the signer
Build the backend for a full-stack ZK application with noir.js and bb.js
How to create proofs and verify them in a front-end
Last updated on June 12, 2025
Duration: 6min
Duration: 1h 11min
Duration: 2h 12min
Duration: 3h 19min
Course Overview
About the course
Noir syntax
Create a witness, a proof, and Solidity verifier contracts
Use the Poseidon commitment scheme
Create ZK circuits and build a full ZK protocol
ZK Merkle trees and hashing in Noir
Verify signatures without revealing the signer
Build the backend for a full-stack ZK application with noir.js and bb.js
How to create proofs and verify them in a front-end
Last updated on June 12, 2025