Installing the SDK

You can download and install the latest version of the DFINITY Canister smart contract SDK, called dfx, by running the command below. The topics here provide additional information about installing, upgrading, and removing the SDK.

dfx is natively supported on Linux or macOS 12.* Monterey or later.

To install dfx, run

Setting a default version​

If defined, dfx will always run the version specified in the project's dfx.json in the key "dfx". For example, if your dfx.json contains "dfx": "0.11.1", any dfx command you run within this project's directory will be executed by dfx of version 0.11.1. Should the defined version not be installed (e.g. because you cloned a repo that was created for a different version than you have installed locally), dfx will report an error.

To set a global default (that gets overwritten by project-specific settings from the project's dfx.json), run the install script with the desired version, even if it is already installed.

Building from source​

If you would like to compile dfx by yourself, head over to the sdk repo. The README contains the instructions how you can build it on your own.

Removing the software​

When you install the SDK, the installation script puts the required binary files in a local directory and creates a cache. You can remove the SDK binaries and cache from your local computer by running the uninstall script located in the .cache folder.

For example:

~/.cache/dfinity/uninstall.sh

If you are uninstalling because you want to immediately reinstall a clean version of dfx, you can run the following command:

~/.cache/dfinity/uninstall.sh && sh -ci "\$(curl -sSL https://internetcomputer.org/install.sh)"