infrablockchain-docs
en
en
  • InfraBlockchain
    • Learn
      • Architecture
        • Architecture
        • Network Participants
        • Parachain
          • System Parachains
      • Protocol
        • System Token
        • Transaction Fee
        • Proof of Transaction
      • Substrate
        • Learn
          • Basic
            • Cryptography
            • Blockchain Basics
            • Consensus
            • Networks and Nodes
            • Blockchain Transaction
            • Transaction Life Cycle
            • Offchain Operations
            • Light Client
            • Rust for Substrate
            • Introduction to Library
            • Architecture and Rust Libraries
            • File Architecture
            • Accounts, Addresses, and Keys
            • Transaction Format
            • Blockchain Randomness
          • FRAME
            • FRAME Pallets
            • FRAME Macros
            • Custom Pallets
            • Pallet Coupling
            • Origin
            • Events and Erros
            • Runtime Storage
            • State Transitions and Storage
            • SCALE Encoding
            • Weight and Fee
            • Runtime API
            • Runtime Development
          • Account
          • Address Format
          • Glossary
          • CLI
            • Archive
            • Memory Profiler
            • Node Template
            • sidecar
            • srtool
            • Subkey
            • subxt
            • try-runtime
            • tx-wrapper
          • Runtime Development
            • Basics
              • Configure Genesis State
              • Configure Runtime Constants
              • Customize a Chain Spec
              • Import a Pallet
              • Use Helper Function
            • Consensus Model
              • PoW
              • Create a Hybrid Node
            • Offchain Worker
              • Request Offchain HTTP
              • Offchain Indexing
              • Offchain Local Storage
            • Pallet Design
              • Create a Storage Structure
              • Implement Lockable Currency
              • Incorporate Randomness
              • Loose Coupling
              • Tight Coupling
            • Parachain Development
              • Add HRMP Channel
              • Add Paranodes
              • Connect to a Local Relay Chain
              • Convert a Solo Chain
              • Prepare to Launch
              • Select Collator
              • Upgrade a Parachain
            • Storage Migration
              • Basics
              • Trigger Migration
            • Test
              • Basics
              • Test a Transfer Transaction
            • Tools
              • Create a TxWrapper
              • Use Sidecar
              • try-runtime
              • Verify WASM
            • Weigths
              • Benchmark
              • Calculate Fees
              • Use Conditional Weights
              • Use Custom Weights
        • Build
          • Decide What to Build
          • Build Process
          • Determinisitc Runtime
          • Chain Spec
          • Genesis Configuration
          • Application Development
          • RPC
          • Troubleshoot Your Code
        • Tutorials
          • Install
            • Developer Tools
            • Linux
            • macOS
            • Rust Toolchain
            • Issues
            • Windows
          • Quick Start
            • Explore the Code
            • Modify Runtime
            • Start a Node
            • Substrate Basics
          • Build a Blockchain
            • Add Trusted Nodes
            • Authorize Specific Nodes
            • Build a Local Blockchain
            • Simulate Network
            • Upgrade a Running Network
          • Build Application Logic
            • Add a Pallet
            • Add Offchasin Workers
            • Publish Custom Pallets
            • Specify Origin for a Call
            • Use Macros in a Custom Pallet
          • Integrate with Tools
            • Access EVM Accounts
            • EVM Integration
            • Explore Sidecar Endpoints
            • Integrate a Light Client Node
          • Smart Contracts
            • Strategy
            • Build a Token Contract
            • Develop a Smart Contract
            • Prepare Your First Contract
            • Troubleshoot Smart Contracts
            • Use Maps for Storing Values
      • XCM
        • XCM
        • XCM Format
    • Service Chains
      • InfraDID
      • InfraEVM
      • URAuth(Universal Resource Auth)
    • DevOps
      • Build
      • Deploy
      • Monitoring
      • Runtime Upgrade
    • Tutorials
      • Basic
        • How to Interact with System Token
        • How To Pay Transaction Fee
        • How To Vote with TaaV
        • Hot to Get Validator Reward
      • Build
        • Build InfraRelayChain
        • Build Parachain
        • Open Message Passing Channels
        • Transfer Assets with XCM
      • Test
        • Benchmark
        • Check Runtime
        • Debug
        • Simulate Parachains
        • Unit Testing
      • Service Chains
        • Play with InfraDID
          • Build
          • Add Keys
          • Add Service Endpoint
          • Create InfraDID
        • Play with InfraEVM
          • Build
          • Deposit and Withdraw Token
          • Deploy ERC20 Contract
          • Deploy ERC721 Contract
          • Deploy ERC1155 Contract
  • Newnal Data Market
Powered by GitBook
On this page
  • Before you begin
  • Installation
  • Compile a Substrate node
  • Where to go next
  1. InfraBlockchain
  2. Learn
  3. Substrate
  4. Tutorials
  5. Install

macOS

Set up a local development environment for Substrate on macOS.

You can install Rust and set up a Substrate development environment on Apple macOS computers with either Intel or an Apple M1 processors.

Before you begin

Before you install Rust and set up your development environment on macOS, verify that your computer meets the following basic requirements:

  • Operating system version is 10.7 Lion, or later.

  • Processor speed of at least 2Ghz, 3Ghz recommended.

  • Memory of at least 8 GB RAM, 16 GB recommended.

  • Storage of at 10 GB available space.

  • Broadband Internet connection.

Support for Apple Silicon

Protobuf must be installed before the build process can begin. To install it, run the following command:

brew install protobuf

Install Homebrew

In most cases, you should use Homebrew to install and manage packages on macOS computers. If you don't already have Homebrew installed on your local computer, you should download and install it before continuing.

To install Homebrew:

  1. Open the Terminal application.

  2. Download and install Homebrew by running the following command:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  3. Verify Homebrew has been successfully installed by running the following command:

    brew --version

    The command displays output similar to the following:

    Homebrew 3.3.1
    Homebrew/homebrew-core (git revision c6c488fbc0f; last commit 2021-10-30)
    Homebrew/homebrew-cask (git revision 66bab33b26; last commit 2021-10-30)

Installation

Because the blockchain requires standard cryptography to support the generation of public/private key pairs and the validation of transaction signatures, you must also have a package that provides cryptography, such as openssl.

To install openssl and the Rust toolchain on macOS:

  1. Open the Terminal application.

  2. Ensure you have an updated version of Homebrew by running the following command:

    brew update
  3. Install the openssl package by running the following command:

    brew install openssl
  4. Download the rustup installation program and use it to install Rust by running the following command:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  5. Follow the prompts displayed to proceed with a default installation.

  6. Update your current shell to include Cargo by running the following command:

    source ~/.cargo/env
  7. Verify your installation by running the following command:

    rustc --version
  8. Configure the Rust toolchain to default to the latest stable version by running the following commands:

    rustup default stable
    rustup update
    rustup target add wasm32-unknown-unknown
  9. Add the nightly release and the nightly WebAssembly (wasm) targets to your development environment by running the following commands:

    rustup update nightly
    rustup target add wasm32-unknown-unknown --toolchain nightly
  10. Verify the configuration of your development environment by running the following command:

    rustup show
    rustup +nightly show

    The command displays output similar to the following:

    # rustup show
    
    active toolchain
    ----------------
    
    stable-x86_64-apple-darwin (default)
    rustc 1.61.0 (fe5b13d68 2022-05-18)
    
    # rustup +nightly show
    
    active toolchain
    ----------------
    
    nightly-x86_64-apple-darwin (overridden by +toolchain on the command-line)
    rustc 1.63.0-nightly (e71440575 2022-06-02)
    1. Install cmake using the following command:

    brew install cmake

Compile a Substrate node

Now that you have Rust installed and the Rust toolchains configured for Substrate development, you are ready to finish setting up your development environment by cloning the Substrate node template files and compiling a Substrate node.

The node template provides a working environment that includes all of the most common features you need to build a blockchain without any extraneous modules or tools. To ensure that the node template offers a relatively stable working environment for you to experiment with, the recommended best practice is to clone Substrate node template from the Substrate Developer Hub repository, rather than from the core Substrate repository.

To compile the Substrate node template:

  1. Clone the node template repository by running the following command:

    git clone https://github.com/substrate-developer-hub/substrate-node-template
  2. Change to the root of the node template directory by running the following command:

    cd substrate-node-template

    If you want to save your changes and make this branch easy to identify, you can create a new branch by running a command similar to the following:

    git switch -c my-wip-branch
  3. Compile the node template by running the following command:

    cargo build --release

    Because of the number of packages required, compiling the node can take several minutes.

After the build completes successfully, your local computer is ready for Substrate development activity.

Where to go next

Here are a few additional suggestions for where you can learn more.

Tell me

Guide me

PreviousLinuxNextRust Toolchain

Last updated 1 year ago

In most cases, you can clone the main branch to get the latest code. However, you can use the --branch command-line option if you want to work with a Substrate branch that is compatible with a specific Polkadot version. Click to see the list of branches that are compatible with specific Polkadot versions.

The Substrate Developer Hub acts as a central portal for access to the many resources available to the community. Depending on your interests and learning style, you might prefer one avenue over another. For example, if you prefer to read source code and are familiar with Rust, you might want to start by digging into the .

Tags
Rust API
Architecture
Networks and blockchains
Build process
Build a local blockchain
Simulate a network
Add trusted nodes