0.3 Developer environment setup
Overview
Before you can begin our developer journey, you need to set up our developer environment. A developer environment consists of tools and packages that are required to develop code projects. Usually, developer environments are stored and hosted on your local computer, but there are some situations where a virtual, web-based development environment exists.
An example of this is the playground, which is a web-based, virtual developer environment that can be used by developers without having to set up a local environment. Deploying to the playground is ICP's equivalent of deploying to a testnet network.
The playground has several restrictions, however, and it isn't recommended to be used for workflows other than simple, small-scale testing.
Setting up your developer environment
Confirm you have a connection to the internet
To follow along with the developer journey and develop on the Internet Computer, you will need a connection to the internet.
Why does this matter?
You will need an internet connection to download a few different tools and packages, as described further in this document. You will also need an internet connection whenever you plan to deploy your canister to the mainnet. You do not need an internet connection to deploy your canister to your local canister execution environment.
Confirm you have access to a command line interface (CLI) on your local macOS or Linux computer
Open a command line interface (CLI) window. This may be referred to as 'Terminal' or 'Shell' depending on your computer's operating system. In this documentation, this is often referred to as the 'terminal window'.
Why does this matter?
You will primarily be using CLI-based tools, such as dfx
and git
, in this developer journey.
Options for Windows users
dfx
is not natively supported on Windows. To download dfx
on Windows, you will need to download the Windows Subsystem for Linux. Learn more about how to install dfx on Windows.
Download and install the IC SDK
The IC SDK contains the CLI tool dfx
. dfx
is natively supported on Linux or macOS 12.* Monterey or later.
There is no native support for dfx
on Windows. However, by installing the Windows Subsystem for Linux (WSL 2), you can run dfx
on a Windows system.
Not all features of dfx
may be supported on WSL 2.
To install the IC SDK, install dfxvm
. dfxvm
is a CLI tool used for installing and switching between different versions of dfx
, enabling developers to pivot between different projects that are built with different dfx
versions.
Download and install the latest version of dfxvm
with the following command:
sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
If you are using a machine running Apple silicon, you will need to have Rosetta installed. You can install Rosetta by running softwareupdate --install-rosetta
in your terminal.
Why does this matter?
The IC SDK is composed of several components that are required for developing on the Internet Computer. These components are:
dfx
: The CLI tool used to interact with and develop canisters on ICP. Motoko is included in the installation of dfx.moc
: The Motoko runtime compiler.replica
: The Internet Computer's local network binary.
Download and install a code editor
To write and edit code, you will need a code editor. macOS and Linux systems come with some basic editors, such as vi
or nano
, but these have very limited functionality and can be hard to use.
It is recommended that you use Visual Studio Code, as it is a popular choice and there is a Motoko extension that provides additional tools for Motoko development.
Why does this matter?
Code editors are a core component to writing and developing code.
Download and install git
Download and install git.
Why does this matter?
Many of the DFINITY public repositories are hosted on Github, such as our examples
repository. You will be using code from this repository later in the developer journey, so it is important to install git
to assure that you can download the sample code pieces and follow along with the later tutorials.
Download and install Node.js
Download and install Node.js 16.0.0
or newer.
Why does this matter?
Node.js is used by dfx
to generate frontend code and dependencies. It is not required for dapps that do not contain a frontend interface, though it is required for you to follow along with this developer journey series, since you will explore frontend canisters in a later tutorial.
Assure all packages and tools are updated to the latest release versions
If you have followed this guide and installed each of these tools for the first time, you will have the most recent release versions installed.
If you previously had installed any of these tools, be sure to check the most recent release version and update them if needed.
Why does this matter?
Having the latest release version assures that you have all of the newest features and bug fixes for each tool to assure for the most seamless developer experience.
Create a working directory
The last step in setting up our developer environment is to create a new directory for you to build in. You can create a new directory with the command:
mkdir developer_journey
In future modules, you'll refer to this directory as the working directory. Each project that you create will be a sub-directory of this working directory.
Why does this matter?
You'll use this working directory to contain the projects that you build throughout your developer journey. This will help keep things organized in our local file structure.
Need help?
Did you get stuck somewhere in this tutorial, or feel like you need additional help understanding some of the concepts? The ICP community has several resources available for developers, like working groups and bootcamps, along with our Discord community, forum, and events such as hackathons. Here are a few to check out:
Developer Discord, which is a large chatroom for ICP developers to ask questions, get help, or chat with other developers asynchronously via text chat.
Motoko Bootcamp - The DAO Adventure - Discover the Motoko language in this 7 day adventure and learn to build a DAO on the Internet Computer.
Motoko Bootcamp - Discord community - A community for and by Motoko developers to ask for advice, showcase projects and participate in collaborative events.
Weekly developer office hours to ask questions, get clarification, and chat with other developers live via voice chat. This is hosted on the Discord server.
Submit your feedback to the ICP Developer feedback board.