Skip to main content
Anchor Version Manager (AVM) is a command-line tool for managing multiple installations of the Anchor CLI. It allows you to easily switch between Anchor versions for different projects, which is essential for:
  • Working with projects that require specific Anchor versions
  • Creating verifiable builds that match deployed programs
  • Testing features across different Anchor releases
  • Maintaining legacy projects

Installation

Install AVM using Cargo:
Verify installation:

Commands

avm install

Install a specific version of Anchor CLI.
Install by Version:
Install by Commit:
Options:
  • --force - Force installation even if version exists
  • --from-source - Build from source instead of downloading prebuilt binaries
  • --verify - Also install solana-verify tool
  • --path <PATH> - Install from a local Anchor repository
Examples:
Prebuilt binaries are available for most releases. Use --from-source if you need a custom build or encounter binary compatibility issues.

avm use

Switch to a specific Anchor CLI version.
Examples:
The version must be installed before using it. Run avm install <VERSION> first.

avm list

List all installed Anchor CLI versions.
Alias:
Example Output:
The asterisk (*) indicates the currently active version.

avm uninstall

Remove an installed Anchor CLI version.
Example:
You cannot uninstall the currently active version. Switch to a different version with avm use first.

avm update

Update to the latest Anchor CLI release.
This is equivalent to:

avm completions

Generate shell completion scripts for AVM.
Supported Shells:
  • bash
  • zsh
  • fish
  • powershell
  • elvish
Setup Examples: Bash:
Zsh:
Fish:

Usage Patterns

Project-Specific Versions

Use different Anchor versions for different projects:

Anchor.toml Integration

Specify the required Anchor version in your project’s Anchor.toml:
Anchor.toml
Anchor CLI will automatically use the specified version if installed via AVM:
If the required version isn’t installed:

Verifiable Builds

AVM is essential for creating verifiable builds that match deployed programs:

Testing Multiple Versions

Test your program against different Anchor versions:

Installation Locations

AVM installs Anchor CLI versions to: Linux/macOS:
Windows:

PATH Configuration

AVM requires ~/.avm/bin in your PATH. Add to your shell configuration: Bash (~/.bashrc):
Zsh (~/.zshrc):
Fish (~/.config/fish/config.fish):
Reload your shell:

Troubleshooting

Version Not Found

Error:
Solution:

Command Not Found

Error:
Solutions:
  1. Check PATH configuration:
  2. Ensure a version is selected:
  3. Reinstall AVM:

Build Failures

Error when using --from-source:
Solutions:
  1. Ensure Rust toolchain is up to date:
  2. Install build dependencies (Linux):
  3. Try without --from-source:

Permission Denied

Error:
Solution: Ensure ~/.avm is writable:

Advanced Usage

CI/CD Integration

GitHub Actions:

Docker Integration

Best Practices

Always document the required version:
This helps collaborators use the correct version.
Avoid --from-source unless necessary:
Prebuilt binaries are faster and more reliable.
Periodically update AVM itself:
Include installation instructions in your README:

Resources