Getting Started with Movement CLI
Movement uses Aptos Move for smart contracts. Aptos Move is a compiled language, so you need to install a compiler to be able to write and run Move programs.
The compiler is included in both the Aptos and Movement binaries and this guide will walk you through the installation and basic usage of Movement CLI, with a focus on inter operability between Aptos and Movement.
Installing Movement CLI On macOS and Linux
You can easily install Movement CLI on Windows, macOS and Linux. Here are the step-by-step instructions for each platform.
Step 1: Clone the CLI Repository
First, clone the repository from GitHub:
git clone https://github.com/movementlabsxyz/aptos-core/ && cd aptos-core
Step 2: Build the Movement CLI
Next, build the Movement CLI using Cargo (You'll need to have Cargo: Rust's package manager installed in this case):
cargo build -p movement
This command will generate the target/debug/movement
executable.
Step 3: Add Movement CLI to Your PATH
To make the movement
command available globally, you need to add it to your system's PATH
. Here’s how you can do it
sudo cp target/debug/movement /usr/local/bin/
If this doesn't work, you can install Aptos CLI via Homebrew.
Step 4: Install Aptos via Homebrew
If you don't have Homebrew installed, execute this command to install it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Now, execute this command to install Aptos CLI via Homebrew
brew install aptos
You can use the Aptos CLI to work with Movement in the same vein.
Step 5: Using Movement CLI
Movement CLI commands are analogous to those of Aptos CLI. You can always replace aptos
with movement
like this:
aptos move build
To get help with the CLI tool, you can use:
aptos --help
Or, for help with a specific subcommand:
aptos <subcommand> --help
Now that you've installed Movement or Aptos CLI, you can now publish and interact with smart contracts on the Movement Network.
Installing Aptos CLI on Windows
Step 1: Prerequisites
Ensure you have the following requirements:
- Python 3.6+ installed
- PowerShell access
Step 2: Install via Python Script (Recommended Method)
Verify Python installation:
python3 --version
If Python is not installed, download it from python.org.
Run the Aptos CLI installation script:
Invoke-WebRequest -Uri "https://aptos.dev/scripts/install_cli.py" -OutFile "$env:TEMP\install_cli.py"; python "$env:TEMP\install_cli.py"
Step 3: Update PATH
Copy and run the PATH update command provided in the terminal:
setx PATH "%PATH%;C:\Users\<your_account_name>\.aptoscli\bin"
Step 4: Verify Installation
Open a new terminal and run:
aptos help
You should see a list of available CLI commands.
Step 5: Update Aptos CLI (Optional)
To update to the latest version:
aptos update
Alternative Installation Method: Pre-Compiled Binaries
If the Python script method doesn't work, you can install via pre-compiled binaries:
Step 1: Download Binaries
- Visit the Aptos CLI release page
- Expand "Assets"
- Download the Windows zip file (e.g.,
aptos-cli-<version>-Windows-x86_64.zip
)
Step 2: Install Binaries
- Unzip the downloaded file
- Move the file to your preferred directory
- Copy the path to the executable (e.g.,
C:\Users\<username>\Downloads\aptos-cli-3.1.0-Windows-x86_64\aptos.exe
)
Step 3: Verify Installation
In PowerShell, use the full path to run:
C:\Users\<username>\Downloads\aptos-cli-3.1.0-Windows-x86_64\aptos.exe help
Step 4: Update (Manual Method)
To update with pre-compiled binaries:
- Delete the existing installation
- Repeat the download and installation steps
Next Steps
Now that you have Movement CLI installed, you can start building and testing Move contracts.
Step 1: Compile and Test Move Contracts
Use the following command to compile your Move contracts:
movement move compile
Step 2: Publish Contracts to the Network
To publish your contracts to the network, use:
movement move publish
Step 3: Interact with the Blockchain
You can interact with the blockchain by creating accounts, querying account information, and more:
movement account create
Following these steps should help you to get started with Movement CLI, build and deploy Move contracts efficiently.