A simple, lightweight shell script to install and switch between multiple Go versions on Linux and macOS.
curl -O https://raw.githubusercontent.com/7e3b/shell-go-version-manager/main/gvm.sh
chmod +x gvm.sh
sudo cp gvm.sh /usr/local/bin/gvmAdd GVM's active Go version to your PATH:
echo 'export PATH="$HOME/.gvm/current/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcecho 'export PATH="$HOME/.gvm/current/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcInstall and activate a Go version:
gvm 1.24.4If the version is already installed, GVM simply switches to it.
gvm 1.25.0Switch back to a previously installed version:
gvm 1.24.4Verify the active version:
go version- Detects your operating system and CPU architecture
- Supports Linux and macOS
- Supports AMD64 and ARM64
- Downloads the requested Go version from
go.dev - Installs multiple Go versions side-by-side
- Automatically switches between installed versions
- Uses a symbolic link to manage the active version
- Stores Go versions in
~/.gvm - Does not require
sudoto install or switch Go versions - Cleans up temporary files after installation
GVM stores Go versions in your home directory:
~/.gvm/
├── versions/
│ ├── 1.24.4/
│ ├── 1.25.0/
│ └── 1.25.1/
└── current -> versions/1.25.1
The active Go installation is available through:
~/.gvm/current/bin/go
- Linux or macOS
bashcurlorwgettar
No Go installation or sudo privileges are required.
| Operating System | Architecture |
|---|---|
| Linux | AMD64 |
| Linux | ARM64 |
| macOS | AMD64 |
| macOS | ARM64 (Apple Silicon) |
gvm 1.24.4
gvm 1.23.6
gvm 1.21.12Once installed, switching between versions is as simple as:
gvm 1.24.4
go version
gvm 1.25.0
go versionMake sure /usr/local/bin is in your PATH:
echo $PATHAlternatively, invoke the script directly:
/usr/local/bin/gvm 1.24.4Make sure GVM's active Go directory is in your PATH:
export PATH="$HOME/.gvm/current/bin:$PATH"For Bash, add it to:
~/.bashrc
For Zsh, add it to:
~/.zshrc
Then reload your shell configuration.
Make sure you have an active internet connection and that the requested Go version exists on go.dev.
GVM currently supports:
- Linux AMD64
- Linux ARM64
- macOS AMD64
- macOS ARM64
See LICENSE.