Installing and Setting Up OpenCode
Harry
· 13 Sep 2026
· 4 views
Prerequisites
You need Node.js installed on your machine. OpenCode is distributed as an npm package and also as a standalone installer for macOS and Linux.
Install with npm
npm install -g opencodeOnce installed, open a terminal inside any project folder and start OpenCode with:
opencodeInstall on macOS and Linux
curl -fsSL https://opencode.ai/install | bashAuthenticate a Model Provider
opencode auth loginChoose your provider, paste an API key from your provider account, and OpenCode is ready to use. You can add several providers and switch at any time.
Key Points
- Install globally with npm, or use the official installer.
- Run opencode inside the folder you want it to work in.
- Add your own API keys with opencode auth login.
- You pay the provider, not for the tool.