Run OpenCode from a self-contained directory — no global install, no PATH changes, no files written to your home folder. Everything lives inside .opencode_portable/ next to the wrapper script.
.opencode_portable/
├── bin/ # OpenCode binary
├── config/ # XDG_CONFIG_HOME (settings, skills)
├── data/ # XDG_DATA_HOME
├── cache/ # XDG_CACHE_HOME
├── state/ # XDG_STATE_HOME
└── .version # Currently cached version
| Platform | Required |
|---|---|
| macOS | curl, unzip (both ship with macOS) |
| Linux (glibc) | curl, tar |
| Linux (Alpine/musl) | curl, tar — install via apk add curl tar |
| Windows | PowerShell 5.1+ (built into Windows 10/11) |
All platforms need git if you plan to install external skill plugins.
macOS / Linux — requires curl (listed in Prerequisites above):
curl -fLO https://raw.githubusercontent.com/anomalyco/opencode/dev/opencode-portable.sh
chmod +x opencode-portable.shWindows (PowerShell) — requires PowerShell 5.1+ (built into Windows 10/11):
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/anomalyco/opencode/dev/opencode-portable.ps1" -OutFile "opencode-portable.ps1"The script auto-detects your architecture, including Rosetta translation.
chmod +x opencode-portable.sh
./opencode-portable.shchmod +x opencode-portable.sh
./opencode-portable.shThe script automatically detects musl-based distros (Alpine) and selects the correct binary. On x64, it also detects AVX2 support and falls back to a baseline build if needed.
Alpine/musl note — ensure curl and tar are installed:
apk add curl tarSet-ExecutionPolicy -Scope Process Bypass
.\opencode-portable.ps1The Scope Process setting only applies to the current terminal session.
Option A — environment variable (highest priority):
# macOS/Linux
OPENCODE_PORTABLE_VERSION=1.0.180 ./opencode-portable.sh
# Windows
$env:OPENCODE_PORTABLE_VERSION = "1.0.180"
.\opencode-portable.ps1Option B — create a .opencode-version file next to the script:
1.0.180
The leading v is stripped automatically, so both 1.0.180 and v1.0.180 work.
# macOS/Linux
./opencode-portable.sh --portable-update
# Windows
.\opencode-portable.ps1 -PortableUpdate# macOS/Linux
./opencode-portable.sh --portable-version
# Windows
.\opencode-portable.ps1 -PortableVersion"Permission denied" when running the shell script
chmod +x opencode-portable.shPowerShell blocks script execution
Set-ExecutionPolicy -Scope Process BypassThis only affects the current session. For a persistent change, use -Scope CurrentUser.
"curl: command not found" (Linux)
# Debian/Ubuntu
sudo apt install curl
# Fedora/RHEL
sudo dnf install curl
# Alpine
apk add curl"tar: command not found" (Alpine)
apk add tarBinary downloads but OpenCode won't start Check that the download completed successfully. A partial or corrupted download can be fixed with:
./opencode-portable.sh --portable-update # macOS/Linux
.\opencode-portable.ps1 -PortableUpdate # Windows