Getting Rust & Scrypto
  • 01 Oct 2024
  • 3 Minutes to read
  • Dark
    Light
  • PDF

Getting Rust & Scrypto

  • Dark
    Light
  • PDF

Article summary

Here you'll find steps for installing the Scrypto toolchain on Linux, macOS and Windows. Troubleshooting suggestions follow after the installation instructions.

Install the Scrypto Toolchain

To begin working with Scrypto, you need to first prepare you system for Rust development. Then you can install the Scrypto Libraries, Radix Engine Simulator (resim) and command line tools from the Radixdlt-Scrypto github repository.

1. Install Rust compiler

On Windows:

  • Install git by running the git installer for windows

    • Enable git long path support:

      git config --system core.longpaths true
      
  • Visit the Visual Studio Downloads page:

    • Download "Build Tools for Visual Studio 2022"
    • Once the download is complete, open the downloaded file to run the installer.
    • In the installer, you will see various workloads you can install. Look for "Desktop development with C++".
    • Tick the checkbox next to "Desktop development with C++". This will automatically select all the necessary components for C++ development.
    • After selecting the necessary workload, click the "Install" button at the bottom right of the installer window.
    • Once the installation is complete, you can close the installer.
    • To verify the installation, you can open a Command Prompt or PowerShell and type cl to check if the C++ compiler (cl.exe) is available.
  • Download and install rustup-init.exe

  • Install LLVM 13.0.1 (make sure you tick the option that adds LLVM to the system PATH)

On macOS:

  • Make sure you have the xcode command line tools by running:

    xcode-select --install
    
  • Install cmake and LLVM

    brew install cmake llvm
    
  • Check, which shell is the default one by inspecting $SHELL variable:

    echo $SHELL
    
  • Add LLVM to the system path, by opening the file ~/.zshrc or ~/.zshrc:

    • ~/.profile if bash is the default shell

    • ~/.zshrc if zsh is the default shell

    • respective config file in case of other shell

    • Use ~/.zshrc if zsh is the default shell:

      nano ~/.zshrc
      
    • Use ~/.profile if bash is the default shell:

      nano ~/.profile
      

      Add the following line to the file:

      PATH="$(brew --prefix llvm)/bin:$PATH"
      

      To save the changes you’ve made to the file, press Ctrl+o and then Enter. To exit nano , press Ctrl+x and then Enter.

  • Install Rust compiler

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    

On Linux:

  • Make sure a C++ compiler and LLVM is installed:

    sudo apt install clang build-essential llvm
    
  • Install Rust compiler

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    

2. Enable cargo in the current shell

On Windows:

  • Start a new PowerShell

On macOS or Linux:

source $HOME/.cargo/env

3. Add WebAssembly target

On Windows, macOS or Linux:

rustup target add wasm32-unknown-unknown

4. Install Radix Engine Simulator and command-line tools

On Windows, macOS or Linux:

cargo install --force radix-clis

When you install the simulator crate you get two things, the scrypto CLI tool which is essentially a wrapper around the cargo CLI tool with a few adjustments and resim the Radix Engine Simulator

Next Steps

If your not sure what to do after installing Scrypto have a look at our Learning Step-by-Step to learn how to start making Scrypto packages and dapps.

Troubleshooting

Have an x86 (Intel-based) MacOS? Try the following steps:

  • Define rust stable:

    rustup default 1.77.2
    
  • Install LLVM@15 using brew:

    brew install llvm@15
    
  • Confirm the Installation Path:

    brew --prefix llvm@15
    

Output: /usr/local/opt/llvm@15

  • Add LLVM to the system path, by opening the file ~/.zshrc using:

    nano ~/.zshrc
    

    Add the following line to the file:

    PATH="$(brew --prefix llvm@15)/bin:$PATH"
    

    To save the changes you’ve made to the file, press Ctrl+o and then Enter. To exit nano , press Ctrl+x and then Enter.

  • Reload the environment:

    source ~/.zshrc
    
  • Check that the installation of LLVM was done correctly by checking the clang version

    clang --version
    

Output:

Homebrew clang version 15.0.7
Target: x86_64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm@15/bin

More Information


Was this article helpful?