Skip to main content
Version: v0.17.0

Nargo Installation

nargo is a command line tool for interacting with Noir programs (e.g. compiling, proving, verifying and more).

Alternatively, the interactions can also be performed in NoirJS.

UltraPlonk

Nargo versions <0.5.0 of aztec_backend and aztec_wasm_backend are based on the TurboPlonk version of Aztec Backend, which lacks efficient implementations of useful primitives (e.g. Keccak256 in 18k constraints, ECDSA verification in 36k constraints) that the UltraPlonk version offers.

Installation

There are four approaches for installing Nargo:

Optionally you can also install Noir VS Code extension for syntax highlighting.

Option 1: Noirup

If you're on OSX or Linux, the easiest way to start using Noir and Nargo is via noirup. Just open a terminal and run:

curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash

Close the terminal, open another one, and run

noirup

Done, you should have the latest version working. You can check with nargo --version.

You can also install nightlies, specific versions or branches, check out the noirup repository for more information.

GitHub Actions

You can use noirup with GitHub Actions for CI/CD and automated testing. It is as simple as installing noirup and running tests in your GitHub Action yml file.

See the config file in this repo containing hash functions in Noir for an example.

Nightly versions

To install the nightly version of Noir (updated daily) run:

noirup -n

Option 2: Binaries

See GitHub Releases for the latest and previous platform specific binaries.

Step 1

Paste and run the following in the terminal to extract and install the binary:

macOS / Linux: If you are prompted with Permission denied when running commands, prepend sudo and re-run it.

macOS (Apple Silicon)
mkdir -p $HOME/.nargo/bin && \
curl -o $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-aarch64-apple-darwin.tar.gz && \
tar -xvf $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \
echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \
source ~/.zshrc
macOS (Intel)
mkdir -p $HOME/.nargo/bin && \
curl -o $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-apple-darwin.tar.gz && \
tar -xvf $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \
echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \
source ~/.zshrc
Linux (Bash)
mkdir -p $HOME/.nargo/bin && \
curl -o $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-unknown-linux-gnu.tar.gz && \
tar -xvf $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -C $HOME/.nargo/bin/ && \
echo -e '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.bashrc && \
source ~/.bashrc

Step 2

Check if the installation was successful by running nargo --help.

macOS: If you are prompted with an OS alert, right-click and open the nargo executable from Finder. Close the new terminal popped up and nargo should now be accessible.

For a successful installation, you should see something similar to the following after running the command:

$ nargo --help

Noir's package manager

Usage: nargo <COMMAND>

Commands:
check Checks the constraint system for errors
codegen-verifier Generates a Solidity verifier smart contract for the program
compile Compile the program and its secret execution trace into ACIR format
new Create a new binary project
execute Executes a circuit to calculate its return value
prove Create proof for this program. The proof is returned as a hex encoded string
verify Given a proof and a program, verify whether the proof is valid
test Run the tests for this program
gates Counts the occurrences of different gates in circuit
help Print this message or the help of the given subcommand(s)

Option 3: Compile from Source

Due to the large number of native dependencies, Noir projects uses Nix and direnv to streamline the development experience. It helps mitigating issues commonly associated with dependency management, such as conflicts between required package versions for different projects (often referred to as "dependency hell").

Combined with direnv, which automatically sets or clears environment variables based on the directory, it further simplifies the development process by seamlessly integrating with the developer's shell, facilitating an efficient and reliable workflow for managing and deploying Noir projects with multiple dependencies.

Setting up your environment

For the best experience, please follow these instructions to setup your environment:

  1. Install Nix following their guide for your operating system.
  2. Create the file ~/.config/nix/nix.conf with the contents:
experimental-features = nix-command
extra-experimental-features = flakes
  1. Install direnv into your Nix profile by running:
nix profile install nixpkgs#direnv
  1. Add direnv to your shell following their guide.
    1. For bash or zshell, add eval "$(direnv hook bash)" or eval "$(direnv hook zsh)" to your ~/.bashrc or ~/.zshrc file, respectively.
  2. Restart your shell.

Shell & editor experience

Now that your environment is set up, you can get to work on the project.

  1. Clone the repository, such as:
git clone git@github.com:noir-lang/noir

Replacing noir with whichever repository you want to work on.

  1. Navigate to the directory:
cd noir

Replacing noir with whichever repository you cloned.

  1. You should see a direnv error because projects aren't allowed by default. Make sure you've reviewed and trust our .envrc file, then you need to run:
direnv allow
  1. Now, wait awhile for all the native dependencies to be built. This will take some time and direnv will warn you that it is taking a long time, but we just need to let it run.

  2. Once you are presented with your prompt again, you can start your editor within the project directory (we recommend VSCode):

code .
  1. (Recommended) When launching VSCode for the first time, you should be prompted to install our recommended plugins. We highly recommend installing these for the best development experience.

Building and testing

Assuming you are using direnv to populate your environment, building and testing the project can be done with the typical cargo build, cargo test, and cargo clippy commands. You'll notice that the cargo version matches the version we specify in flake.nix, which is 1.66.0 at the time of this writing.

If you want to build the entire project in an isolated sandbox, you can use Nix commands:

  1. nix build . (or nix build . -L for verbose output) to build the project in a Nix sandbox.
  2. nix flake check (or nix flake check -L for verbose output) to run clippy and tests in a Nix sandbox.

Without direnv

If you have hesitations with using direnv, you can launch a subshell with nix develop and then launch your editor from within the subshell. However, if VSCode was already launched in the project directory, the environment won't be updated.

Advanced: If you aren't using direnv nor launching your editor within the subshell, you can try to install Barretenberg and other global dependencies the package needs. This is an advanced workflow and likely won't receive support!

Option 4: WSL (for Windows)

Windows is not directly supported at this time. To install Noir on a Windows machine, it is recommended to use WSL.

Step 1: Follow the instructions here to install and run WSL.

step 2: Follow the Noirup instructions.

Uninstalling Nargo

Noirup

If you installed Noir with noirup, you can uninstall Noir by removing the files in ~/.nargo, ~/nargo and ~/noir_cache.

rm -r ~/.nargo
rm -r ~/nargo
rm -r ~/noir_cache

Nix

If you installed Noir with Nix or from source, you can remove the binary located at ~/.nix-profile/bin/nargo.

rm ~/.nix-profile/bin/nargo