Quick Start
1. Prerequisites
- Node.js >= 20.0.0
Mops downloads and manages the Motoko toolchain itself — moc, pocket-ic, wasmtime, lintoko, wasm-opt. It does not need dfx installed, and does not support it.
2. Install Mops CLI
Install from on-chain storage
curl -fsSL cli.mops.one/install.sh | sh
or install from npm registry
npm i -g ic-mops
3. Initialize
Run this command in the root directory of your project
mops init
4. Pin the Motoko compiler
Every command that compiles — mops build, mops check, mops test — uses the moc pinned in mops.toml.
mops toolchain use moc latest
Run mops toolchain info moc --versions to see what is available, and see toolchain management for the rest of the tools.
5. Install Motoko Packages
Use mops add to install a specific package and save it to mops.toml
mops add core
6. Import Package
Now you can import installed packages in your Motoko code
import Array "mo:core/Array";
7. Deploy
Mops builds and type-checks; it does not deploy. Use icp, whose Motoko recipe builds each canister with mops build, so the moc you pinned above is the compiler that produces the deployed Wasm.
Mops does not support dfx. mops sources still prints --package flags for any build tool that takes a packtool, but it carries dependencies only — a tool that brings its own compiler will not use your pinned moc.