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:-
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. - Restart your computer when prompted.
- After reboot, launch Ubuntu from the Start menu. On the first launch, create a UNIX username and password when prompted.
-
Open the Ubuntu terminal and run:
Installing Homebrew
-
Run the Homebrew install script:
-
Add Homebrew to your shell environment:
-
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.-
Install
asdf
using Homebrew: -
Add
asdf
to your shell: -
Verify that
asdf
is installed correctly:
Installing Scarb, Starknet Foundry, and Starknet Devnet
-
Add the Scarb plugin and install the latest Scarb version:
-
Add the Starknet Foundry plugin and install the latest Starknet Foundry version:
-
Add the Starknet Devnet plugin and install the latest Starknet Devnet version:
-
Restart your terminal and verify that Scarb, Starknet Foundry, and Starknet Devnet were installed correctly:
If
scarb
,snforge
, orstarknet-devnet
are not recognized, try runningsource ~/.bashrc
or restarting your terminal.
Fetching a predeployed Sepolia account
Procedure:-
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
.
- For Ready wallets: navigating to
- Create a keystore file by running:
- Fetch the account by running:
Troubleshooting
Starkli unable to detect shell
Procedure:- Detect whether your shell is
zsh
orbash
:
- Add:
~/.zshrc
or ~/.bashrc
.
- Restart the terminal, and run either:
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:
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:
- Find the compiler versions supported by Starkli by running:
--compiler-version
flag.
- Find the current Scarb version in use:
-
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: