Skip to main content
The Cube CLI (cube) is a single-binary command-line interface for the Cube platform. Use it to create and manage deployments, deploy data model code, work with the data model Git workflow, connect GitHub repositories, tail deployment logs, and automate workspace administration from scripts and CI.
The Cube CLI works with the Cube cloud platform. It is not required for running Cube Core locally.

Installation

Linux / macOS:
Windows (PowerShell):
The installer downloads the release binary for your platform and adds it to your PATH. Set CUBE_VERSION to pin a release tag, or CUBE_INSTALL_DIR to change the install location. The CLI checks for new releases in the background and prints a notice when one is available. Update in place at any time:
Running cube with no arguments prints the installed version above the help text.

Authentication

Sign in with the browser device flow — the CLI prints a URL and a short code, opens your browser, and waits for approval:
Credentials are saved to ~/.config/cube/config.toml (Linux/macOS) or %APPDATA%\cube\config.toml (Windows). Multiple accounts are supported as named contexts (--name on login, --context on any command), and expired access tokens refresh automatically. For CI and scripts, use an API key instead:

Deploy a project

The core workflow — create a deployment, connect a database, upload your data model, and query it:
1

Create a deployment

2

Connect a database

3

Deploy your project

cube deploy hashes local files, uploads only what changed, removes remote files deleted locally (--keep-missing opts out), and triggers a single build. Pass --branch to deploy to a specific data model branch instead of the active dev-mode branch (or the deploy branch, if none is active).
4

Watch the build and query

Use the token against the deployment’s REST (JSON) API endpoint.

Import from GitHub

Connect a deployment to a GitHub repository instead of uploading files:
Connecting clones the repository into the deployment and triggers the first build.

Command reference

Run cube <command> --help for the full options of any command. List commands print tables by default; pass --json anywhere for raw JSON output, suitable for piping to jq.

Data model Git workflow

Edit the data model through branches without touching production:
merge-to-default merges into the deploy branch and rebuilds production.
File writes (put, delete, rename) only land on a dev-mode branch. With --dev-mode, create-branch (and dev-mode) forks a personal dev-… branch and prints it — pass that printed name via --branch, not the name you gave create-branch, or omit --branch to use your active dev-mode branch. Writes targeting any other branch are rejected by the API.
enable-branch keeps a shared branch’s staging environment always active, so it stays queryable without anyone viewing the branch in the UI — useful for running tests against a branch from CI. disable-branch reverts to the default, where the environment is only active while viewed. cube data-model branches DEPLOYMENT_ID shows the current state per branch, and cube environments list DEPLOYMENT_ID --type staging lists the enabled ones with their API credentials.

dbt sync

Pull a dbt project’s models in as cubes. The repository, credential and warehouse settings come from the deployment’s dbt integration, so a sync needs only the deployment:
Each sync creates a new branch for the generated cubes and prints its name. --wait polls until the sync finishes, reporting each stage, then prints the generated files; it exits non-zero if the sync fails. Without --wait it returns a syncJobId you can follow yourself:
--ref syncs a specific branch or tag of the dbt repository instead of the one saved on the integration — which is what makes a pull-request gate meaningful, since otherwise every run would compile the tracked branch:
--ref takes a branch or tag, not a commit SHA. Syncs are not free — each one provisions a sandbox and parses the project — so prefer one per push over one per commit.

dbt sync as a CI test gate

Sync the branch under review, compile it, query it, and fail the job if any step breaks — without touching production:
With --wait --json, the sync writes one document carrying both the branch to compile and how the sync ended, which is why the branch name is available to the next step. Compile and query share a step because the dev-mode branch name is only known at runtime.
The compile step has to run against the dev-mode branch, not the branch the sync created. A sync lands on a shared branch, and a shared branch has nothing compiling it until someone opens it in dev mode. cube data-model dev-mode forks a personal dev-… branch and prints the name to wait on.Waiting on the wrong branch fails quickly rather than hanging: build-status reports such a branch as building with an error of Branch is not active (or Bad branch if it doesn’t exist), and --wait stops and says so.
The API key needs SchemaUpdate on the deployment to start or cancel a sync, and SchemaRead to follow one. Any failure — a failed sync, a failed compile, a timeout — exits non-zero, so the job fails without extra scripting.
A gate that runs per pull request accumulates the branches its syncs create. There is no CLI command to delete a branch yet, so prune them from the data model UI periodically, or merge the ones you want to keep.

Environment variables

Telemetry

The CLI sends anonymous usage events (command group, success/failure, version, platform). No personal data is collected; the anonymous identifier is a hash of the OS machine id. Telemetry is disabled automatically in CI, or explicitly with CUBE_NO_TELEMETRY=1 (or the legacy CUBEJS_TELEMETRY=false).