Skip to content

CLI Installation ​

The Chainabit CLI is an npm package and needs Node.js 20 or later. After installation, both chainabit and cb run the same CLI. The install command is the same on every system; what differs is how you get Node.js and how your shell finds globally installed commands. Follow the steps for your system.

Step 1: Check Node.js ​

Open a terminal (Terminal on macOS, your shell on Linux, PowerShell on Windows) and run:

bash
node --version

If it prints v20 or later, continue to Step 2. If the command is missing or the version is older, install Node.js first:

Install Node.js with Homebrew:

bash
brew install node

Without Homebrew, download the installer from nodejs.org and run it. Then open a new terminal window and check again with node --version.

Step 2: Install the CLI ​

The command is the same on macOS, Linux, and Windows:

bash
npm install -g @chainabit/cli

Step 3: Verify the install ​

bash
chainabit --version
chainabit --help
cb --help

If your shell prints that chainabit was not found, or Windows refuses to run it, use the fix for your system below.

Step 4: Fix a missing command ​

The global install puts chainabit in npm's global directory. Your shell must be able to find that directory.

Find the directory:

bash
npm config get prefix

Add its bin folder to your PATH in ~/.zshrc, then reload the file:

bash
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

If the install itself failed with EACCES, do not use sudo. Give npm a global directory you own, then repeat Step 2:

bash
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Local Project Install ​

bash
npm install --save-dev @chainabit/cli
npm exec -- chainabit --help

Upgrade ​

bash
npm install -g @chainabit/cli@latest

Uninstall ​

bash
npm uninstall -g @chainabit/cli

After Install ​

The quickest way to start is:

bash
chainabit auth login
chainabit auth whoami
chainabit workspace list

Choose a workspace ID from the result, select it with chainabit workspace use <id>, then check chainabit workspace current. Continue with the quickstart for your first workflow.

If you are working in automation, prefer a developer token:

bash
export CHAINABIT_DEVELOPER_TOKEN="cbt_live_..."
chainabit auth login --token-env CHAINABIT_DEVELOPER_TOKEN

You can also use stdin when a pipeline already has the token available:

bash
printf '%s' "$CHAINABIT_DEVELOPER_TOKEN" | chainabit auth login --token-stdin

Secure Install Notes ​

  • Avoid passing passwords, API keys, or tokens directly on the command line when possible.
  • Load a trusted environment file explicitly with --env-file <path> or CHAINABIT_ENV_FILE; local .env files are not discovered automatically.
  • If your environment already has a valid token, set CHAINABIT_TOKEN instead of performing an interactive login.

Troubleshooting ​

  • command not found: follow Step 4 to put npm's global directory on PATH
  • wrong version after upgrade: restart your shell and run hash -r
  • private registry: configure npm registry/auth before installing

Built with purpose. chainabit.com