How to Install OpenCode and Oh My OpenCode

OpenCode and Oh My OpenCode are powerful AI-powered development tools that enhance coding productivity. This guide walks through the installation process for both tools.

What is OpenCode?

OpenCode is an AI coding assistant that integrates with your development environment to provide intelligent code suggestions, explanations, and automation capabilities. It leverages large language models to understand context and assist with various coding tasks.

What is Oh My OpenCode?

Oh My OpenCode is an enhanced framework built on top of OpenCode that provides additional features, customizations, and specialized agents for more complex development workflows. It offers improved orchestration capabilities and advanced tooling.

Prerequisites

Before installing, ensure you have:

  • Node.js: Version 18.x or higher
  • npm or yarn: Latest stable version
  • Git: For cloning repositories
  • API Keys: Access to required AI model providers (OpenAI, Anthropic, etc.)
  • Operating System: macOS, Linux, or Windows with WSL2

Installing OpenCode

Step 1: Install via npm

1
npm install -g @opencode/cli

Or using yarn:

1
yarn global add @opencode/cli

Step 2: Verify Installation

1
opencode --version

Step 3: Initialize Configuration

1
opencode init

This creates a configuration file in your home directory (~/.opencode/config.json).

Step 4: Configure API Keys

Edit the configuration file to add your API keys:

1
opencode config set api-key YOUR_API_KEY

Or manually edit ~/.opencode/config.json:

1
2
3
4
5
{
"apiKey": "your-api-key-here",
"model": "claude-sonnet-4.5",
"provider": "anthropic"
}

Installing Oh My OpenCode

Step 1: Clone the Repository

1
2
git clone https://github.com/ohmyopencode/ohmyopencode.git
cd ohmyopencode

Step 2: Install Dependencies

1
npm install
1
npm link

This allows you to use omo command globally.

Step 4: Configure Oh My OpenCode

1
omo init

Follow the interactive prompts to:

  • Set up your preferred AI provider
  • Configure agent behaviors
  • Enable specific skills and plugins
  • Set working directories

Step 5: Install Additional Plugins

1
2
3
omo plugin install git-master
omo plugin install frontend-ui-ux
omo plugin install playwright

Verification

Test your installation:

1
2
3
4
5
6
# Test OpenCode
opencode chat "Hello, are you working?"

# Test Oh My OpenCode
omo --version
omo agent list

Common Installation Issues

Issue 1: Permission Denied

If you encounter permission errors during global installation:

1
2
3
4
5
6
7
8
# Use sudo (not recommended for security)
sudo npm install -g @opencode/cli

# Or fix npm permissions (recommended)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Issue 2: API Key Not Recognized

Verify your API key is correctly set:

1
opencode config list

If missing, reconfigure:

1
opencode config set api-key YOUR_ACTUAL_KEY

Issue 3: Node Version Mismatch

Check your Node.js version:

1
node --version

If below 18.x, upgrade using nvm:

1
2
nvm install 18
nvm use 18

Issue 4: Command Not Found After Installation

Ensure your PATH includes npm global binaries:

1
2
echo $PATH
npm config get prefix

Add to your shell profile if missing:

1
export PATH="$(npm config get prefix)/bin:$PATH"

Getting Started

Basic OpenCode Usage

1
2
3
4
5
6
7
8
# Start interactive chat
opencode chat

# Analyze a file
opencode analyze src/index.js

# Generate code
opencode generate "function to validate email"

Basic Oh My OpenCode Usage

1
2
3
4
5
6
7
8
# Start an interactive session
omo

# Run specific agent
omo run explore "Find authentication implementation"

# Execute with specific skill
omo --skill git-master "Create atomic commits for my changes"

Configuration Best Practices

OpenCode Configuration

Edit ~/.opencode/config.json:

1
2
3
4
5
6
7
{
"apiKey": "your-key",
"model": "claude-sonnet-4.5",
"temperature": 0.7,
"maxTokens": 4096,
"timeout": 60000
}

Oh My OpenCode Configuration

Edit ~/.omo/config.yaml:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
agents:
explore:
thoroughness: medium
oracle:
consultMode: true

skills:
- git-master
- frontend-ui-ux
- playwright

providers:
anthropic:
apiKey: ${ANTHROPIC_API_KEY}
model: claude-sonnet-4.5

Next Steps

After successful installation:

  1. Explore Documentation: Visit official docs for advanced features
  2. Join Community: Connect with other users for tips and tricks
  3. Configure Agents: Customize agent behaviors for your workflow
  4. Install Skills: Add specialized skills for your tech stack
  5. Integrate with IDE: Set up VS Code or other IDE extensions

Troubleshooting Resources

  • Official Documentation: Check the latest docs for updates
  • GitHub Issues: Search existing issues or report new ones
  • Community Forums: Ask questions and share experiences
  • Stack Overflow: Tagged questions for common problems

Conclusion

OpenCode and Oh My OpenCode are powerful tools that can significantly enhance your development workflow. With proper installation and configuration, you’ll have AI-powered assistance for coding tasks, architecture decisions, and complex problem-solving.

Start exploring the capabilities and integrate these tools into your daily development routine for maximum productivity gains.