# Installing the Agoric SDK

To write JavaScript smart contracts using the Agoric Zoe framework, first install the Agoric Software Development Kit (SDK).

After installing the Agoric SDK, you can proceed to starting a project.

# Getting Support

# Quick Start

If you're on a supported platform (MacOS, Linux, or WSL) and you're familar with JavaScript development tools such as node, yarn, and git:

go version # Version 1.20.3 or higher
node --version # LTS version such as 18.16.0
npm install --global yarn # Install yarn for package management
git clone --branch community-dev https://github.com/Agoric/agoric-sdk # Clone the "community-dev" branch
cd agoric-sdk
yarn install # Asks yarn to install all the dependant node packages
yarn build # Builds the agoric-sdk packages
(cd packages/cosmic-swingset && make) # Builds the cosmic-swingset package
yarn link-cli ~/bin/agoric # Creates an executable script
agoric --version # Prints the version number of the SDK

Now you are ready proceed to starting a project.

If you get "command not found", see troubleshooting below.

Watch: Prepare Your Agoric Environment (November 2020)

This presentation is a good overview of the Agoric SDK setup process, though a few details are out of date:

  • node version: 12.x is too old; use the LTS version 18.16.0 or a later LTS version
  • skip git checkout hackathon-2020-11; use the community-dev branch

Note: Video omits adding the Agoric SDK to your PATH.

# Platform: Linux Shell or Equivalent

The Agoric SDK is supported on Linux, MacOS, and Windows Subsystem for Linux (WSL).

  • To open a terminal on MacOS, see Applications>Utilities>terminal in the Finder.
  • To launch a terminal on Linux, use the Terminal application.
  • To access WSL from Windows, visit the WSL documentation (opens new window).

Mac Dev Tools

On a Mac, you must first install Xcode (opens new window)

# Install Go

Download Go from go.dev/doc/install (opens new window) and follow the instructions for your platform.

go version # Version 1.20.3 or higher

# Install Node.js

Download Node.js from Node.js (opens new window) and follow the instructions for your platform. We recommend installing the LTS version of node 18.

node --version # LTS version such as 18.16.0

Note: Agoric will support all long-term support (LTS) versions of Node.js.

# Install the Yarn Package Manager

Follow Yarn Installation (opens new window) instructions. For example:

npm install --global yarn
yarn --version # 1.22.10 or higher

# Install Git

Follow Git installation instructions (opens new window) or use your platform's package manager.

npm install --global git
git --version # 2.25.0 or higher

# Clone the Agoric SDK

git clone --branch community-dev https://github.com/Agoric/agoric-sdk
cd agoric-sdk

Cloning and installing the Agoric SDK can take a while. Please be patient.

# Install NPM Dependencies

yarn install

Note: If you run into errors during install or build, make sure you have the relevant developer tools installed. For example, on Debian or Ubuntu Linux, you can run sudo apt get install build-essential to install these tools.

# Build Packages

yarn build

Note: If this yarn build step fails, check that you are on a supported platform and not native Windows.

# Build the Cosmic Swingset Package

(cd packages/cosmic-swingset && make)

# Install Agoric CLI

Use yarn link-cli to install the Agoric CLI (Command Line Interface) in a convenient place of your choosing such as:

yarn link-cli ~/bin/agoric

or:

sudo yarn link-cli /usr/local/bin/agoric

Note: Run echo $PATH to see directories in your current path, separated by colons. These are good candidates for where to have yarn link-cli place the executable.

Troubleshooting "command not found"

Watch:

# Check the Agoric Version

To check that it's installed correctly:

agoric --version # v0.18.2 "community-dev" branch

If the install was successful, you are ready to proceed to starting a project.