- 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:Commands
avm install
Install a specific version of Anchor CLI.--force- Force installation even if version exists--from-source- Build from source instead of downloading prebuilt binaries--verify- Also installsolana-verifytool--path <PATH>- Install from a local Anchor repository
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.The version must be installed before using it. Run
avm install <VERSION> first.avm list
List all installed Anchor CLI versions.avm uninstall
Remove an installed Anchor CLI version.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.avm completions
Generate shell completion scripts for AVM.bashzshfishpowershellelvish
Usage Patterns
Project-Specific Versions
Use different Anchor versions for different projects:Anchor.toml Integration
Specify the required Anchor version in your project’sAnchor.toml:
Anchor.toml
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:PATH Configuration
AVM requires~/.avm/bin in your PATH. Add to your shell configuration:
Bash (~/.bashrc):
Troubleshooting
Version Not Found
Error:Command Not Found
Error:-
Check PATH configuration:
-
Ensure a version is selected:
-
Reinstall AVM:
Build Failures
Error when using--from-source:
-
Ensure Rust toolchain is up to date:
-
Install build dependencies (Linux):
-
Try without
--from-source:
Permission Denied
Error:~/.avm is writable:
Advanced Usage
CI/CD Integration
GitHub Actions:Docker Integration
Best Practices
Specify Versions in Anchor.toml
Specify Versions in Anchor.toml
Always document the required version:This helps collaborators use the correct version.
Use Prebuilt Binaries
Use Prebuilt Binaries
Avoid Prebuilt binaries are faster and more reliable.
--from-source unless necessary:Keep AVM Updated
Keep AVM Updated
Periodically update AVM itself:
Document Version Requirements
Document Version Requirements
Include installation instructions in your README: