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 | { |
Installing Oh My OpenCode
Step 1: Clone the Repository
1 | git clone https://github.com/ohmyopencode/ohmyopencode.git |
Step 2: Install Dependencies
1 | npm install |
Step 3: Link Globally (Optional)
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 | omo plugin install git-master |
Verification
Test your installation:
1 | # Test OpenCode |
Common Installation Issues
Issue 1: Permission Denied
If you encounter permission errors during global installation:
1 | # Use sudo (not recommended for security) |
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 | nvm install 18 |
Issue 4: Command Not Found After Installation
Ensure your PATH includes npm global binaries:
1 | echo $PATH |
Add to your shell profile if missing:
1 | export PATH="$(npm config get prefix)/bin:$PATH" |
Getting Started
Basic OpenCode Usage
1 | # Start interactive chat |
Basic Oh My OpenCode Usage
1 | # Start an interactive session |
Configuration Best Practices
OpenCode Configuration
Edit ~/.opencode/config.json:
1 | { |
Oh My OpenCode Configuration
Edit ~/.omo/config.yaml:
1 | agents: |
Next Steps
After successful installation:
- Explore Documentation: Visit official docs for advanced features
- Join Community: Connect with other users for tips and tricks
- Configure Agents: Customize agent behaviors for your workflow
- Install Skills: Add specialized skills for your tech stack
- 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.