Hiro has developed Clarinet to be environment-agnostic. Follow this guide to install and build Clarinet.
Topics covered in this guide:
- Install Clarinet
- Build Clarinet from source using Cargo
- Use Clarinet to generate shell completion scripts
You may choose to install Clarinet in any of the following operating systems:
To install Clarinet, you may choose from the following:
There is no difference in Clarinet functionality based on the environment you select.
Install on macOS (Homebrew)
To install Clarinet using macOs, you must first install Homebrew on your system. If you do not already have Homebrew already installed, please refer to the Homebrew documentation for detailed information on installing Homebrew.
Once you have Homebrew installed, run the below command in your terminal.
brew install clarinet
For more information on how to install Clarinet on macOS, please see the Setting Up Your Clarity Development Environment (Mac) video walkthrough.
Install on Windows
The easiest way to install Clarinet on Windows is to use the MSI installer, which you can download from the Hiro releases page.
You may also install Clarinet on Winget. Microsoft created this package manager, which includes the latest Windows updates.
Enter the command below.
winget install clarinet
For more information on how to install Clarinet on Windows, please see the Setting Up Your Clarity Environment (Windows) video walkthrough.
Install from a pre-built binary
If you would like to install Clarinet from pre-built binaries, you must first download the latest release from the
Hiro releases page. When you have downloaded the latest release,
unzip the binary and copy it to a location already in your path, such as
/usr/local/bin, using the command shown below.
# note: you can change the v0.27.0 version that is available on the releases page.
wget -nv https://github.com/hirosystems/clarinet/releases/download/v0.27.0/clarinet-linux-x64-glibc.tar.gz -O clarinet-linux-x64.tar.gz
tar -xf clarinet-linux-x64.tar.gz
chmod +x ./clarinet
mv ./clarinet /usr/local/bin
If you use macOS, you may receive security errors when running the pre-compiled binary. To resolve the security warning, use the command below and replace the path
/usr/local/bin/clarinetwith your local binary file.
xattr -d com.apple.quarantine /usr/local/bin/clarinet
Install from source using Cargo
You may also install Clarinet using Cargo. If you choose this option, please be aware that you must first install Rust.
For more information on installing Rust, please see the Install Rust page for access
cargo, the Rust package manager.
If you are using Debian or Ubuntu-based distributions, you must also install the following package to build Clarinet:
sudo apt install build-essential pkg-config libssl-dev
Once you have installed Clarinet using Cargo, you can build Clarinet from the source using Cargo with the following commands:
git clone https://github.com/hirosystems/clarinet.git --recursive
By default, you will be placed in our development branch,
develop, with code that has not yet been released.
- If you plan to submit any code changes, this is the right branch for you.
- If you prefer the latest stable version, switch to the main branch by entering the command below.
git checkout main
If you have previously checked out the source, ensure you have the latest code (including submodules) before building using this command:
git submodule update --recursive
Clarinet also provides tools for interacting with your contracts in a Read, Evaluate, Print, Loop (REPL) console and perform automated testing of contracts.
Setup shell completions
Clarinet already has many different commands built in. Therefore, enabling tab completion in your shell may be useful.
Using the command below, you can use
clarinet to generate the shell completion scripts for many common shells.
clarinet completions (bash|elvish|fish|powershell|zsh)
After generating the file, you can refer to the documentation for your shell to determine where this file should be moved to and what other steps may be necessary to enable tab completion for