Preliminary steps for newcomers

If this is the first time you are installing developer tools on your computer, you might need to take a few extra steps to prepare your environment.

The instructions here assume that you are using a macOS computer.

Before you install the DFINITY Canister SDK, you need to know:

  • How to open and run commands in a terminal

  • How to check for and install packages and dependencies

  • How to create and navigate to new directories

The steps in this section describe how to prepare a basic development environment.

Open a terminal

To open the Terminal application on macOS:

  1. Open the Finder.

  2. Click Applications, open Utilities, then double-click Terminal.

    Alternatively, you can press the kbd:[⌘ + spacebar] keyboard keys to open Search, then type terminal.

    The terminal is where you are going to execute command-line instructions. To execute a command, you type or copy and paste an instruction, then press kbd:[Return].

  3. Check your current path by running the print working directory–pwd—command, then pressing kbd:[Return].

    pwd

    This command displays your current directory with a path like /Users/<your-user-name>.

    After you open the Terminal application, you can open new terminal shell at any time by clicking Shell, then selecting New Window or New Tab.

    By default, a new terminal shell always opens in your home directory with a path like /Users/<your-user-name>.

Check for packages

The Homebrew application is a package manager for macOS that makes it easy to install and update packages—that is, external programs—that you need to have available in a local development environment.

The node.js package provides a JavaScript runtime environment and modules for front-end user interface development. The node.js package is not required to build programs, but you’ll probably need it if you want to add a graphical user interface to your program.

If your development environment is Linux, you can use a package manager of your choice instead of Homebrew to install packages and manage dependencies.

To check and install packages:

  1. Check whether you have the Homebrew package manager installed by running the following command:

    brew --version

    If the command returns version information, continue to the next step. If Homebrew isn’t installed, copy and paste the following command in your terminal:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  2. Check whether you have the node.js package manager installed by running the following command:

    node --version

    If the command returns version information, continue to Create a working folder. If node.js isn’t installed, copy and paste the following command in your terminal:

    brew install node

Create a working folder

By default, a new terminal shell always opens in your home directory with a path like /Users/<your-user-name>. To keep your workspace tidy, you can create a separate folder for your Internet Computer projects.

To create a new working folder:

  1. Open a terminal shell on your local computer, if you don’t already have one open.

  2. Create a new folder called ic-projects in your home directory by running the following command:

    mkdir ic-projects
  3. Change to the new working folder by running the following command:

    cd ic-projects

Now you’re ready to install the DFINITY Canister SDK and get coding!