Installation
Learn how to install cpm on your system.
Prerequisites
Before installing cpm, ensure you have:
- Go 1.21 or later - For building from source
- Git - Version 2.0 or later
- SQLite3 - For the local database (usually pre-installed)
- SSH - For SSH key management features
Installation Methods
Option 1: Download Pre-built Binary
The easiest way to install cpm is to download a pre-built binary:
# Linux (x86_64)
curl -L https://github.com/yourusername/cpm/releases/latest/download/cpm-linux-amd64 -o cpm
chmod +x cpm
sudo mv cpm /usr/local/bin/
# macOS (Intel)
curl -L https://github.com/yourusername/cpm/releases/latest/download/cpm-darwin-amd64 -o cpm
chmod +x cpm
sudo mv cpm /usr/local/bin/
# macOS (Apple Silicon)
curl -L https://github.com/yourusername/cpm/releases/latest/download/cpm-darwin-arm64 -o cpm
chmod +x cpm
sudo mv cpm /usr/local/bin/
Option 2: Build from Source
If you prefer to build from source:
# Clone the repository
git clone https://github.com/yourusername/cpm.git
cd cpm
# Build
go build -o cpm main.go
# Install
sudo cp cpm /usr/local/bin/
Option 3: Install with Go
If you have Go installed:
go install github.com/yourusername/cpm@latest
Option 4: Package Managers
Homebrew (macOS/Linux)
brew tap yourusername/cpm
brew install cpm
APT (Debian/Ubuntu)
# Add repository
echo "deb [trusted=yes] https://apt.yourdomain.com/ /" | sudo tee /etc/apt/sources.list.d/cpm.list
# Install
sudo apt update
sudo apt install cpm
Verify Installation
Check that cpm is installed correctly:
cpm --version
You should see output like:
cpm version 0.1.0
Initialize cpm
After installation, initialize cpm:
cpm init
This creates the necessary configuration and database files at ~/.cpm/.
Configuration Files
cpm creates the following files:
~/.cpm/config.yaml- Main configuration file~/.cpm/cpm.db- SQLite database~/.cpm/ssh/- SSH key storage (optional)
Upgrading
To upgrade cpm to the latest version:
# If installed with curl
curl -L https://github.com/yourusername/cpm/releases/latest/download/cpm-linux-amd64 -o cpm
chmod +x cpm
sudo mv cpm /usr/local/bin/
# If installed with go install
go install github.com/yourusername/cpm@latest
# If installed with brew
brew upgrade cpm
Uninstalling
To remove cpm:
# Remove binary
sudo rm /usr/local/bin/cpm
# Remove configuration (optional)
rm -rf ~/.cpm
Next Steps
- Quick Start - Get started with cpm
- Configuration - Configure cpm for your needs
- Commands Overview - Learn available commands
Troubleshooting
If you encounter issues during installation:
- Permission Denied: Use
sudowhen moving to/usr/local/bin/ - Command Not Found: Ensure
/usr/local/binis in your PATH - Build Errors: Check that you have Go 1.21 or later
See the Troubleshooting Guide for more help.