Guides9 min read

Capacitor CLI commands: the practical guide

Every Capacitor CLI command you actually use — add, sync, copy, update, run, open, doctor — what each does, when to run it, and how the OtaKit CLI fits alongside for live updates.

You'll run a handful of Capacitor CLI commands constantly and the rest almost never. This guide covers the ones that matter — what each does, when to run it, and the mistakes that cause “my change isn't showing up” — plus where the OtaKit CLI fits alongside for live updates.

The commands you actually use

  • npx cap add ios / android — create a native project. Run once per platform.
  • npx cap copy — copy your latest web build into the native projects.
  • npx cap sync — copy and update native dependencies. Run after installing a plugin.
  • npx cap open ios / android — open the native project in Xcode / Android Studio.
  • npx cap run ios / android — build and launch on a device or emulator.
  • npx cap doctor — check your setup and flag version mismatches.

The number-one confusion: copy vs sync. Use copy after a web change; use sync after a plugin change (it also updates native deps). When in doubt, sync — it does both.

The typical loop

npm run build        # build your web app
npx cap sync         # push it + deps into native
npx cap open ios     # open Xcode to run/submit

The thing to internalize: Capacitor doesn't watch your web build. If you changed your web app and don't see it on device, you almost certainly skipped build then copy/sync.

Where the OtaKit CLI comes in

The Capacitor CLI manages the native build. The OtaKit CLI ships web-layer updatesto already-installed apps. After a binary is live, you stop running cap open for every change and start running:

otakit upload --release production

See the OtaKit CLI reference for every command and flag, and npm scripts to wrap both CLIs into simple one-liners.

Add npx cap sync to a post-install hook so teammates' native projects never drift from the plugins in package.json — a frequent source of “works on my machine” build failures.

Where to go next

See the setup docs for the full first-run flow, and version mismatch for when cap doctor complains.

Related docs