Install
openclaw skills install near-cli-toolsGuide for installing, setting up, verifying, and using NEAR Protocol CLI (near-cli-rs) on all platforms, including obtaining the absolute path of the near bi...
openclaw skills install near-cli-toolsCRITICAL FOR AGENTS: Before calling any
nearcommand, you MUST find the absolute path of thenearbinary (e.g., usingwhich nearorwhereis near) and use that absolute path in your commands. This ensures consistency across different shell environments.
This skill provides comprehensive guidance for installing and setting up the NEAR Protocol CLI (near-cli-rs) on any platform.
Choose the installation method that works best for your system:
Best for: Most Linux and macOS users
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/latest/download/near-cli-rs-installer.sh | sh
if not add near to PATH:
find the near binary by whereis near
Add to PATH:
# Temporary (current session only)
export PATH="$HOME/.cargo/bin:$PATH"
# Permanent (add to your shell config)
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc # For bash
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc # For zsh
Reload your shell or run:
source ~/.bashrc # or ~/.zshrc
Best for: JavaScript/TypeScript developers, Windows users
Run directly without installation:
npx near-cli-rs
Install globally:
npm install -g near-cli-rs
Or add to package.json:
npm install --save-dev near-cli-rs
Then use:
npx near-cli-rs
Best for: Windows users without Node.js or Cargo
near-cli-rs-installer-x64.msi)Best for: Rust developers, custom builds
Prerequisites: Install Rust first from https://rustup.rs/
Install:
cargo install near-cli-rs
Or install latest from git:
cargo install --git https://github.com/near/near-cli-rs
Linux users may need:
# Debian/Ubuntu
sudo apt install libudev-dev
# Fedora/Red Hat
sudo dnf install libudev-devel
After installation, verify it's working:
near --version
Expected output:
near-cli-rs 0.23.6 # or newer version
If the command is not found:
Make sure the installation directory is in your PATH:
echo $PATH | grep cargo # Check if cargo/bin is in PATH
If not found, add it manually:
export PATH="$HOME/.cargo/bin:$PATH"
Test again:
near --version
near --help
# Output will show where config is stored, typically:
# "near CLI configuration is stored in ~/.config/near-cli/config.toml"
near --help
Main command groups:
If you already have a NEAR account:
near account view-account-summary <your-account.near> network-config mainnet now
Example:
near account view-account-summary near network-config mainnet now
If you have a seed phrase or key:
near account import-account
Follow the interactive prompts to sign in.
If you don't have an account yet:
near account create-account
Follow the prompts to create a new account (requires existing account to fund it).
Cause: NEAR CLI is not in your PATH
Solution:
# For shell script installation
export PATH="$HOME/.cargo/bin:$PATH"
# For npm global installation
export PATH="$(npm config get prefix)/bin:$PATH"
# Make it permanent by adding to ~/.bashrc or ~/.zshrc
Cause: Lack of execute permissions
Solution:
chmod +x near-cli-rs-installer.sh
./near-cli-rs-installer.sh
Cause: Download didn't work or file name changed
Solution:
# Check the releases page manually
curl -s https://api.github.com/repos/near/near-cli-rs/releases/latest | grep "browser_download_url" | grep "installer.sh"
Cause: Network issues or slow connection
Solution:
# Use a longer timeout with curl
curl --proto '=https' --tlsv1.2 -LsSf --connect-timeout 30 --max-time 300 https://github.com/near/near-cli-rs/releases/latest/download/near-cli-rs-installer.sh | sh
# Install (Shell script)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/latest/download/near-cli-rs-installer.sh | sh
# Install (npx)
npx near-cli-rs
# Verify installation
near --version
# View account
near account view-account-summary <account-id> network-config mainnet now
# Import account
near account import-account
# Help
near --help
near account --help
near tokens --help