Skip to content

Latest commit

 

History

History
73 lines (53 loc) · 2.22 KB

rust-setup.md

File metadata and controls

73 lines (53 loc) · 2.22 KB
title
Installation

This page will guide you through the steps needed to prepare a computer for development with the Substrate Node Template. Since Substrate is built with the Rust programming language, the first thing you will need to do is prepare the computer for Rust development - these steps will vary based on the computer's operating system. Once Rust is configured, you will use its toolchains to interact with Rust projects; the commands for Rust's toolchains will be the same for all supported, Unix-based operating systems.

Unix-Based Operating Systems

Substrate development is easiest on Unix-based operating systems like macOS or Linux. The examples in the Substrate Tutorials and Recipes use Unix-style terminals to demonstrate how to interact with Substrate from the command line.

macOS

Open the Terminal application and execute the following commands:

# Install Homebrew if necessary https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

# Make sure Homebrew is up-to-date, install openssl and cmake
brew update
brew install openssl cmake

Ubuntu/Debian

Use a terminal shell to execute the following commands:

sudo apt update
# May prompt for location information
sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl

Arch Linux

Run these commands from a terminal:

pacman -Syu --needed --noconfirm cmake gcc openssl-1.0 pkgconf git clang
export OPENSSL_LIB_DIR="/usr/lib/openssl-1.0"
export OPENSSL_INCLUDE_DIR="/usr/include/openssl-1.0"

Rust Developer Environment

This project uses rustup to help manage the Rust toolchain. First install and configure rustup:

# Install
curl https://sh.rustup.rs -sSf | sh
# Configure
source ~/.cargo/env

Finally, configure the Rust toolchain to default to the latest stable version:

rustup default stable

Build the Project

Now that the standard Rust environment is configured, use the included Makefile to install the project-specific toolchains and build the project.