Skip to main content

Overview

The ocx self commands manage the OCX installation itself, including updating to new versions and uninstalling.

Self Update

Update OCX to the latest version.

Usage

ocx self update [options]

Flags

FlagDefaultDescription
--method <method>Auto-detectedOverride install method detection (curl, npm, pnpm, bun)
--forcefalseForce update even if already on latest version

Examples

# Update to latest version
ocx self update

# Force reinstall via npm
ocx self update --method npm --force

How It Works

OCX automatically detects how it was installed and uses the appropriate update method:
  • curl-installed binaries: Downloads from GitHub releases with SHA256 verification.
  • npm/pnpm/bun installs: Uses the respective package manager’s global install command.

Self Uninstall

Remove OCX global configuration files and binary.

Usage

ocx self uninstall [options]

Flags

FlagDefaultDescription
--dry-runfalsePreview what would be removed

What Gets Removed

  • ~/.config/opencode/profiles/ — All profiles
  • ~/.config/opencode/ocx.jsonc — Global OCX config
  • ~/.config/opencode/ — Root directory (only if empty after cleanup)
  • Binary executable (for curl installs only; package-managed installs print the removal command)

Exit Codes

CodeMeaning
0Success (removed, already missing, or dry-run)
1Error (package-managed install, permission denied)
2Safety error (symlink root, containment violation)

Examples

# Preview what would be removed
ocx self uninstall --dry-run

# Remove OCX installation
ocx self uninstall

Notes

  • Package-managed installs: If installed via npm/pnpm/bun/yarn, the command removes config files but prints the package manager removal command instead of deleting the binary directly.
  • Safety: Only removes known OCX files (allowlist approach). Unexpected files in the config directory are left untouched.
  • Symlinks: Symlinks are unlinked without following. Symlink targets are preserved.
  • Idempotent: Safe to run multiple times. Returns success if already uninstalled.

See Also