Installation

Precompiled Binaries

Precompiled binaries can be downloaded from the GitHub releases page. For easier management, we recommend using Foundryup. Currently due to active development it’s recommended to use the latest nightly from the releases page.

Using Foundryup-zksync

Foundryup-zksync is the official installer for the Foundry-ZKsync toolchain. You can learn more about it here.

To install Foundryup-zksync, open your terminal and run the following command:

curl -L https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/install-foundry-zksync | bash

This will install Foundryup-zksync. Simply follow the on-screen instructions, and the foundryup-zksync command will become available in your CLI.

Running foundryup-zksync will automatically install the latest (nightly) versions of the precompiled binaries: forge and cast. For additional options, such as installing a specific version or commit, run foundryup-zksync --help.

ℹ️ Note

Currently only forge and cast are supported for ZKsync. Other commands retain their original behavior but may not work as intended.

ℹ️ Note

If you’re on Windows, you will need to install and use Git BASH or WSL, as your terminal, since Foundryup-zksync currently does not support Powershell or Cmd. Windows support is currently provided as best-effort.

Building from Source

Prerequisites

You’ll need the Rust compiler and Cargo, Rust’s package manager. The easiest way to install both is by using rustup.rs.

Foundry-ZKsync generally supports building only with the configured nightly Rust version. The presence of rust-toolchain file automatically downloads the correct nightly rust version when commands are run from the Foundry-ZKsync directory.

For Windows users, you’ll also need a recent version of Visual Studio, with the “Desktop Development With C++” workload installed.

Building

You can either use the different Foundryup-ZKsync flags:

foundryup-zksync --branch main
foundryup-zksync --path path/to/foundry-zksync

Alternatively, you can install via Cargo with the following command:

cargo install --git https://github.com/matter-labs/foundry-zksync --profile release --locked forge cast

Or, by manually building from a local copy of the Foundry-ZKsync repository:

# clone the repository
git clone https://github.com/matter-labs/foundry-zksync.git
cd foundry
# install Forge
cargo install --path ./crates/forge --profile release --force --locked
# install Cast
cargo install --path ./crates/cast --profile release --force --locked

CI Installation with GitHub Actions

The latest binaries for the appropriate architecture can be installed directly using the following GitHub Action:

steps:
    - name: Install Foundry-ZKsync
      uses: dutterbutter/foundry-zksync-toolchain@v1

For further details, visit the foundry-zksync-toolchain repository.

Using Foundry with Docker

ℹ️ Note

No prebuilt images are available for docker yet.