Skip to content

Installation

Requirements

Install Node.js

Note: to install the latest version of npm, run npm i -g npm

Node Package Manager (NPM) recommends installing Node.js and npm with a Node version manager to avoid permission errors when installing globally. To do so, follow the instructions for your operating system here.

  1. Truffle requires node-gyp for compiling native add-on modules for Node.js. Truffle recommends installing the following node-gyp to avoid errors when installing Truffle. Follow the installation instructions here.

  2. Use nvm to install a compatible version of Node.js. For example, to install Node.js v18 on OSX or Linux, run:

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

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 Ethereum client section for more information.