Skip to content

CodeBuddy Code Installation Guide โ€‹

Installation Methods โ€‹

๐Ÿ“ฆ Install via Package Manager โ€‹

Node.js Package Managers โ€‹

Prerequisites: Node.js 18.20 or higher

Choose your preferred package manager and run the following command:

bash
npm install -g @tencent-ai/codebuddy-code
bash
pnpm add -g @tencent-ai/codebuddy-code
bash
yarn global add @tencent-ai/codebuddy-code
bash
bun install -g @tencent-ai/codebuddy-code

Homebrew (macOS/Linux) โ€‹

No Node.js required, install directly:

bash
# Add tap
brew tap Tencent-CodeBuddy/tap

# Install tool
brew install codebuddy-code
bash
brew install Tencent-CodeBuddy/tap/codebuddy-code
ruby
tap "Tencent-CodeBuddy/tap"
brew "codebuddy-code"

Verify Installation โ€‹

After installation, run the following command to verify successful installation:

bash
codebuddy --version

โš™๏ธ Install via Native Binary (Beta) โ€‹

โš ๏ธ Beta Testing Phase

Native binary installation is currently in Beta testing phase, and features are still being improved. If you encounter any issues, please submit an issue report on the Issues page, or contact technical support (codebuddy@tencent.com).

Features โ€‹

Native binary installation provides the following features compared to the npm version:

  • Single executable file with no additional dependencies
  • No Node.js runtime required
  • Improved automatic update mechanism

Supported Platforms โ€‹

  • macOS (Apple Silicon M1/M2/M3 or Intel x86_64)
  • Linux (arm64 or x86_64)
  • Windows (x86_64)

Migrating from npm Version โ€‹

If you have already installed CodeBuddy Code via npm, you can migrate to the native binary version using the following command:

bash
codebuddy install

Fresh Installation โ€‹

bash
curl -fsSL https://www.codebuddy.cn/cli/install.sh | bash
powershell
irm https://www.codebuddy.cn/cli/install.ps1 | iex

Verify Installation โ€‹

The installation script will automatically download the latest version and configure environment variables. After installation, run the following command to verify:

bash
codebuddy --version

If the command is not available, manually add the installation path to the PATH environment variable:

bash
export PATH="$HOME/.local/bin:$PATH"

# For permanent effect, it's recommended to add to your shell configuration file:
# Bash: ~/.bashrc or ~/.bash_profile
# Zsh: ~/.zshrc
powershell
# Add the following path to user environment variables:
# %USERPROFILE%\AppData\Local\codebuddy\bin

๐Ÿ“ Configuration Directory โ€‹

CodeBuddy Code stores configuration files in the following directory by default:

PlatformDefault Configuration Directory
macOS / Linux~/.codebuddy
Windows%USERPROFILE%\.codebuddy

Directory Contents โ€‹

~/.codebuddy/
โ”œโ”€โ”€ settings.json      # User settings
โ”œโ”€โ”€ .mcp.json          # MCP server configuration
โ””โ”€โ”€ skills/            # User-defined Skills

Custom Configuration Directory โ€‹

You can customize the configuration directory location by setting the CODEBUDDY_CONFIG_DIR environment variable:

bash
export CODEBUDDY_CONFIG_DIR="$HOME/.my-codebuddy-config"

This is useful in the following scenarios:

  • Multiple CodeBuddy instances need independent configurations
  • Enterprise environments that require centralized configuration management
  • Avoiding configuration conflicts when coexisting with other applications using the CodeBuddy engine (such as WorkBuddy)

๐Ÿ”„ Updates โ€‹

Automatic Updates โ€‹

CodeBuddy Code automatically stays up to date by default to ensure you have the latest features and security fixes.

Disable Automatic Updates โ€‹

To disable automatic updates, set the environment variable:

bash
export DISABLE_AUTOUPDATER=1

Manual Updates โ€‹

Use the following command to manually update to the latest version:

bash
codebuddy update

The update command will automatically detect your installation method and perform the corresponding update operation.

Update via Package Manager โ€‹

If the codebuddy update command fails to update successfully, you can also reinstall using your package manager:

bash
npm install -g @tencent-ai/codebuddy-code

Or use the corresponding installation command with other package managers (pnpm, yarn, bun).

๐Ÿ”ง Troubleshooting โ€‹

Command Not Available โ€‹

Issue: After installation, you get codebuddy: command not found

Solution:

  1. Check if the installation path is in the PATH environment variable:

    bash
    echo $PATH
  2. Add the CodeBuddy installation path to PATH (refer to the Verify Installation section above)

  3. Restart your terminal or reload the configuration file:

    bash
    source ~/.bashrc  # or ~/.zshrc

Still Old Version After Update โ€‹

Issue: npm install -g shows successful installation, but codebuddy --version still shows the old version

This is usually caused by multiple codebuddy executables on the system (e.g., installed via both npm and Homebrew simultaneously, or nvm switched Node versions). For detailed troubleshooting steps, refer to Troubleshooting - npm install succeeded but still running old version.

Network Issues โ€‹

Issue: Network connection failure during installation or update

Solution:

  1. Check network connection
  2. Configure npm registry mirror (if installing via npm):
    bash
    npm config set registry https://registry.npmmirror.com

๐Ÿ—‘๏ธ Uninstallation โ€‹

Uninstall Package Manager Version โ€‹

bash
# Uninstall tool
brew uninstall codebuddy-code

# Remove tap (optional)
brew untap Tencent-CodeBuddy/tap
bash
npm uninstall -g @tencent-ai/codebuddy-code
bash
pnpm remove -g @tencent-ai/codebuddy-code
bash
yarn global remove @tencent-ai/codebuddy-code
bash
bun remove -g @tencent-ai/codebuddy-code

Uninstall Native Binary Version โ€‹

macOS / Linux โ€‹

Remove the executable file:

bash
rm -f ~/.local/bin/codebuddy

Clean Configuration Files (Optional) โ€‹

For complete cleanup, you can delete the configuration directories:

macOS / Linux:

bash
rm -rf ~/.codebuddy
rm -rf ~/.local/share/codebuddy

๐Ÿ’ก Tip: If you customized the configuration directory using the CODEBUDDY_CONFIG_DIR environment variable, delete the corresponding directory as well.