Skip to content

Installation

Requirements

Install Node.js

Linux and macOS

Node Package Manager (NPM) recommends installing Node.js with Node Version Manager (nvm) to avoid permission errors when installing globally.

  1. Use curl or wget to install nvm:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    
    wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    
  2. Confirm that nvm installed correctly. You may need to reload the terminal for the command to work:

    nvm --version
    
  3. Truffle requires node-gyp for compiling native add-on modules for Node.js. Truffle recommends installing the following node-gyp dependencies to avoid errors when installing Truffle:

    xcode-select --install
    
    sudo apt install make g++
    
  4. Use nvm to install a compatible version of Node.js. For example, to install Node.js v15, run:

    nvm install 15
    
  5. Confirm that Node.js has been installed correctly by running node --version.

Windows

Truffle recommends using the installer available from the Node.js site.

Ensure you select Automatically install the necessary tools... during the install to install the required Visual Studio build tools, Python, and Chocolately package manager.

Architecture

Install Truffle

Warning: Avoid using the sudo command when installing Truffle, this can cause permission errors.

In a terminal, use NPM to install Truffle:

npm install -g truffle

You may receive a list of warnings during installation. To confirm that Truffle was installed correctly, run:

truffle version

Ethereum client

Truffle requires a running Ethereum client which supports the standard JSON-RPC API. There are many to choose from, and some better than others for development. Refer to the Choosing an Ethereum client section for more information.