CLI
The crossbind command builds native code, builds and opens apps, and manages extensions, licenses, build containers and settings. Bundler plugins and React Native run crossbind build for you.
Commands at a glance
| Command | Does |
|---|---|
build | compiles the project |
app | builds an app, opens it on the dev server, or makes the key pair for its updates |
add | installs an extension and adds it to crossbind.config.js |
licenses | lists the licenses of the native dependencies |
clean-deps | deletes the dependencies built from source |
docker | manages the toolchain containers |
runner | starts, removes or scaffolds build runners |
login, logout, usage, account delete | your crossbind cloud account |
config | the machine settings in ~/.crossbind/config.json |
Run it from a package script or with npx crossbind. login, logout, usage, account, config and --version (-V) work anywhere; the other commands need a project in the current folder. --help after a command lists its options. Set DEBUG=1 to see the whole error of a failure.
build
-p, --platformwasm,wasi,android,ios,darwin,linux,linuxmusl,win32, orhostfor this machine's desktop platform.- Default
wasm,wasi,androidandios; desktop platforms build only when named -a, --archwasm32,wasm64,arm64-v8a,x86_64,iphoneos,iphonesimulator,arm64orx64.- Defaultevery arch but
wasm64 -r, --runtimest(single-threaded) ormt(multithreaded).- Defaultboth
-b, --build-typereleaseordebug.- Default
release -e, --runtime-env- The binaries to make:
browser,edge,node,native,wasi,httporapp. See below. - Default
target.runtimeEnvfromcrossbind.config.js; without it, only the archives --rebuild-deps [list]- Builds
alldependencies, or the ones named (comma-separated), from source into.crossbind/deps/.CROSSBIND_REBUILD_DEPSdoes the same. - Defaultthe prebuilt dependencies
--bind-imports- Also binds what the app's JavaScript imports into a
browsermodule and writesbrowser/imports.json, for a page that resolves its imports itself, as the playground does. With a bundler, the plugin does this. Rust without a bundler needs@crossbind/core-embind-rustin the app's dependencies. - Defaulta
browsermodule binds only the headers inpaths.native
A list option takes commas or repeats: -p darwin,linux or -p darwin -p linux. Not every combination exists: android, ios and the desktop platforms build mt only, wasi and edge are single-threaded, and ios and darwin build only on a Mac (elsewhere they are skipped).
What -e makes on each platform:
- On
wasm:browser,edgeandnodeeach make a module and its loader. - On a desktop platform:
nodemakes a Node-API addon,nativean executable. - On
wasi:wasimakes a command,httpa wasi:http component. - On any app platform:
appmakes the app without its page, whichapp buildadds. That is the app itself ondarwin,linuxandwin32, and an Xcode or Gradle project oniosandandroid. - Android and iOS take no other value: React Native links their archives.
More in Browser, Node.js and Executables.
What it touches:
- Each step runs in a container of the pinned toolchain image, or where Remote builds sends it.
iosanddarwincompile with Xcode on the Mac. - It writes the cache in
.crossbind/, the output folder (paths.output, by default.crossbind/build) and shared caches in~/.crossbind/cache/, which can be deleted whenever no build runs; aDOCKER_EXECcontainer is made again after. - A project with Conan packages or crates gets
conan.lockandcrossbind.cargo.locknext to its config. - It downloads the crates, Conan packages and sources a build needs.
app
app dev [-p platform]- Opens the app on the dev server. Editing the page reloads it; editing native code rebuilds the host and opens the app again.
app dev -p ios --device [name]- Opens an iOS app on the connected iPhone or iPad, or the one named, instead of the Simulator.
app build [-p platform]- Builds the page and the host and writes the app to
dist/. app key [upload|updater]- Says which keys sign the app and where each is kept.
app key uploadmakes this machine's upload key for Google Play;app key updaterprints a new key pair for a desktop app's updates: the public key forapp.updater.publicKey, the private key forCROSSBIND_UPDATER_PRIVATE_KEYwhere the app is built.
The project needs Vite and @crossbind/plugin-vite. -p is macos, linux, windows, ios or android; without it, crossbind takes CROSSBIND_APP_PLATFORM, else this machine's desktop platform. Vite's own options, such as --port or --mode, pass through to Vite.
What each platform's build writes is listed in Apps. app build -p android signs with this machine's debug key, or with the upload key CROSSBIND_ANDROID_KEYSTORE, CROSSBIND_ANDROID_KEY_ALIAS and CROSSBIND_ANDROID_KEYSTORE_PASSWORD name, and then also writes dist/<name>-android.aab, the bundle Google Play takes.
What it touches: Linux, Windows and Android apps build in the pinned Docker images, so they need RUNNER=DOCKER_RUN or DOCKER_EXEC. Android's Gradle caches stay in ~/.crossbind/cache/android/ and its debug key in ~/.crossbind/android/. An Android app opens through this machine's adb, which crossbind does not install. With --device, Xcode signs the app for its team with an account Xcode is signed in to, and registers the device with that team.
add
Installs an extension package (a name, name@version or a path) with your project's package manager and adds it to extensions in crossbind.config.js. Running it again for the same package changes nothing. On Windows, the name or path cannot hold spaces, quotes or other characters the shell reads.
licenses
Prints each bundled native dependency with its SPDX license, native version and source URL, and marks the copyleft ones with !. It writes a file only when an option asks for one.
--notices [file]- Writes a third-party notices file in Markdown.
- Default
THIRD-PARTY-NOTICES.md --sbom [file]- Writes a CycloneDX SBOM.
- Default
sbom.cdx.json, or the path in the package'scrossbind.provenance.sbom --json [file]- Writes the list with each license text.
- Default
licenses.json --check- Exits non-zero when a license field is missing or not valid SPDX. With
-e, also when the binary lacks a notice that a bundled runtime's license asks for. --platform <platform>- Adds what that platform's binary links statically beyond the package graph: vendored copies and the toolchain runtime.
-e, --runtime-env node- Adds the crossbind runtime that an addon for
--platformcompiles in; without--platform, the one its loader bundles. -e, --runtime-env app- Adds what an app carries beside its packages: crossbind's runtime, Hermes, JSI's
jsi.cppand webview/webview, for the app--platformnames. -e, --runtime-env native- Adds musl's libc, which a static musl executable links.
--package- With
-e node: writes a Node-API package'sLICENSE,sbom.cdx.jsonand the license field of itspackage.json.
clean-deps
crossbind clean-deps [names...] deletes the dependencies --rebuild-deps built from source (.crossbind/deps/), or only the ones named. The next build uses their prebuilt archives again.
docker
One container per toolchain image and project. [image] is web (the default), android, android-app, linux or windows.
| Command | Does |
|---|---|
docker create [image] | creates the long-lived container that RUNNER=DOCKER_EXEC runs steps in |
docker start [image] | starts it |
docker stop [image] | stops it |
docker delete [image] | removes it |
docker run <program> [params...] | runs one program in the web image as a build step would, in .crossbind/build |
The default, RUNNER=DOCKER_RUN, needs none of these: it starts a fresh container of the pinned image for every step.
runner
runner start- Starts
crossbind-local-runner-<role>in the local Docker and prints the commands that point builds at it. runner delete- Stops and removes that container.
runner init <platform>- Writes a deploy folder for
fly,cloudflare,cloudrunorazureand prints its steps with a new token. It starts nothing.
Their options:
--role- The toolchain the runner has:
web,android,linuxorwindows. Every runner command takes it. - Default
web --portstart: the port it listens on.- Default8787 to 8790, by role
--hoststart: the address it listens on.- Default
127.0.0.1 --tokenstart: the token builds send to it.- Default
$CROSSBIND_RUNNER_TOKEN, else a new one --dirinit: the folder to write.- Default
crossbind-runner-<platform>-<role> --vcpuinitforcloudflareonly: 1 to 4 vCPUs.
How builds use a runner: Remote builds.
login, logout, usage, account
login- Signs in to crossbind cloud: enter the printed code on crossbind.dev/device, signed in there with GitHub or Apple, then type the number the page shows, so it needs a terminal. The token is kept in
~/.crossbind/credentials.json. logout [--all]- Forgets and revokes this machine's token.
--allrevokes the tokens of every machine signed in to the account. usage- This month's cloud build time by image and what is left, and today's playground compiles left.
account delete --yes- Deletes the account and signs out every machine. Without
--yesit deletes nothing.
They talk to CLOUD_URL: https://api.crossbind.dev unless ~/.crossbind/config.json or CROSSBIND_CLOUD_URL names another. Limits, and what the cloud keeps: Remote builds.
config
config get <key>- Prints the value and default of
<key>and of every key whose name contains it. config set <key> <value>- Sets a key in
~/.crossbind/config.json. An unknown key is refused. config delete <key>- Removes a key, so its default applies again.
config list [-t all|system|project]- Prints the machine settings (
system, the default).alladds the project's resolved configuration andprojectprints only that, so both need a project. config keys- Lists every key with its description and default.
The keys:
RUNNER- Where toolchain steps run:
DOCKER_RUN,DOCKER_EXEC,LOCALorREMOTE. Environment:CROSSBIND_RUNNER. - Default
DOCKER_RUN REMOTE_URL,REMOTE_URL_WEB,REMOTE_URL_ANDROID,REMOTE_URL_LINUX,REMOTE_URL_WINDOWS- Runner addresses for
RUNNER=REMOTE. Environment: the same names with aCROSSBIND_prefix. CLOUD_URL- The crossbind cloud of the account commands and cloud builds. Environment:
CROSSBIND_CLOUD_URL. - Default
https://api.crossbind.dev XCODE_DEVELOPMENT_TEAM- The Xcode development team iOS builds sign with.
WASI_SDK_PATH- A local wasi-sdk, 34 or later, for WASI builds under
RUNNER=LOCAL. Environment:CROSSBIND_WASI_SDK_PATH. DOCKER_REGISTRY_MIRROR- A registry prefix to pull the pinned images from; the release digest stays. Environment:
CROSSBIND_REGISTRY_MIRROR. DOCKER_IMAGE_WEB,DOCKER_IMAGE_ANDROID,DOCKER_IMAGE_ANDROID_APP,DOCKER_IMAGE_LINUX,DOCKER_IMAGE_WINDOWS- An image to use instead of the pinned one. Without the release digest, builds are no longer reproducible. Environment:
CROSSBIND_IMAGE_WEBand the like.
Runner tokens are not keys: CROSSBIND_TOKEN and CROSSBIND_TOKEN_<IMAGE> come only from the environment.
npm create crossbind
A separate package, create-crossbind, scaffolds a project from a template. It asks for a name, a folder and a template, and arguments answer in order: <dir> <group> <framework|variant> [<variant>]. The groups are Web, Mobile, Desktop, Backend, Cloud, Native, Library and Extension; -- --help lists every template. It writes the folder and prints the next steps; it installs nothing.