Internet Computer

What is the icp CLI, and how is an Internet Computer project set up?

All help topics

icp is the command-line tool that builds, deploys and manages Internet Computer projects; a project is a folder with an icp.yaml that lists its canisters and how to build each one.

Install

npm i -g @icp-sdk/icp-cli, plus npm i -g @icp-sdk/ic-wasm, which the official recipes use (Node.js 22 or later). icp replaces the older dfx tool; their commands and flags are not interchangeable.

A project
  • icp new my-project starts one from a template.
  • icp.yaml lists the canisters, each usually built by a recipe: @dfinity/motoko, @dfinity/rust, @dfinity/static-site for a frontend, or @dfinity/prebuilt for a ready-made Wasm. Motoko projects also have a mops.toml naming each canister's main file.
  • Each canister can carry settings, such as environment_variables.
Build, deploy, sync
  • icp build compiles every canister to Wasm.
  • icp deploy builds, creates the canisters that don't exist yet, installs or upgrades their code, then syncs (for example, uploads a frontend's files). --mode reinstall wipes a canister's data, so use it with care.
  • At deploy time every canister gets each sibling's id as an environment variable, PUBLIC_CANISTER_ID: followed by the canister's name, so they find each other without hardcoded ids.
Environments
  • local is a network on your computer, started with icp network start -d. ic is the Internet Computer mainnet.
  • icp deploy targets local unless you pass -e ic or another environment you defined.
Deploying to a cloud engine
  • Link the CLI once with the command from the console's Connect your ICP CLI dialog, so it signs as your console identity.
  • Then deploy on the engine's subnet: icp deploy --identity opencloud --subnet SUBNET_ID -e ic. The dialog fills in your subnet id; the engine's settings page shows it too.
Everyday commands
  • icp canister call backend greet '("Ada")' -e ic calls a method.
  • icp canister status backend -e ic shows whether it is running.
  • icp identity list, icp identity default and icp identity principal manage which identity signs.
  • Not sure of a flag? icp followed by a subcommand and --help.

A coding agent can run all of this for you: the engine's Build with agents page gives a prompt that installs the icp-cli, cloud-engine-canisters and deploy-to-cloud-engine skills.

Learn more
Still stuck? Contact support