Skip to main content

Setting up your environment manually on MacOS and Linux

Installing WSL and Ubuntu

Setting up Scarb and Starknet Foundry on Windows requires configuring the Windows Subsystem for Linux (WSL) and installing the tools inside a Linux distribution such as Ubuntu:
  1. Open PowerShell as administrator and run:
    This command installs WSL along with the default Ubuntu distribution. If WSL or virtualization is not yet enabled, reboot and re-run the command as needed.
    If wsl --install does not work, enable WSL manually by running:
    and installing Ubuntu from the Microsoft Store.
  2. Restart your computer when prompted.
  3. After reboot, launch Ubuntu from the Start menu. On the first launch, create a UNIX username and password when prompted.
  4. Open the Ubuntu terminal and run:

Installing Homebrew

  1. Run the Homebrew install script:
  2. Add Homebrew to your shell environment:
  3. Verify that Homebrew was installed correctly:

Installing asdf

Using asdf allows you to easily switch between versions of Scarb, Starknet Foundry, and Starknet Devnet globally or per project.
  1. Install asdf using Homebrew:
  2. Add asdf to your shell:
  3. Verify that asdf is installed correctly:

Installing Scarb, Starknet Foundry, and Starknet Devnet

  1. Add the Scarb plugin and install the latest Scarb version:
  2. Add the Starknet Foundry plugin and install the latest Starknet Foundry version:
  3. Add the Starknet Devnet plugin and install the latest Starknet Devnet version:
  4. Restart your terminal and verify that Scarb, Starknet Foundry, and Starknet Devnet were installed correctly:
    If scarb, snforge, or starknet-devnet are not recognized, try running source ~/.bashrc or restarting your terminal.

Fetching a predeployed Sepolia account

Procedure:
  1. Export the private key from your wallet by:
    • For Ready wallets: navigating to Settings -> <YOUR_ACCOUNT> -> Export Private Key.
    • For Braavos wallets: navigating to Settings -> Privacy and Security -> Export Private Key.
  2. Create a keystore file by running:
and entering the private key of your smart wallet, along with a password that will be used to encrypt it.
  1. Fetch the account by running:

Troubleshooting

Starkli unable to detect shell

Procedure:
  1. Detect whether your shell is zsh or bash:
  1. Add:
to either ~/.zshrc or ~/.bashrc.
  1. Restart the terminal, and run either:
or:

scarb build fails to run version command for Rust

Starting from Scarb version 2.10 and Starknet Foundry version 0.37.0, Rust is longer required for projects with the following line in their Scarb.toml file:
If not all three conditions are met and Rust is not installed, running scarb build (and scarb test) will result in a compilation error. To resolve this, either update Scarb, Starknet Foundry, and your Scarb.toml file accordingly or install Rust.

starkli declare unable to identify compiler version

When using starkli declare, Starkli will do its best to identify the compiler version of the declared class. In case it fails, the --compiler-version flag can be used to specify the version of the compiler. Procedure:
  1. Find the compiler versions supported by Starkli by running:
and looking for the possible values of the --compiler-version flag.
  1. Find the current Scarb version in use:
  1. In case a different compiler version is required, switch to a different Scarb version using asdf: a. Install the desired Scarb version:
    b. Select the desired Scarb version as the local version for the project: