clickhousectl is the CLI for ClickHouse: local and cloud.
With clickhousectl you can:
- Install and manage local ClickHouse versions
- Launch and manage local ClickHouse servers
- Execute queries against ClickHouse servers
- Set up ClickHouse Cloud and create cloud-managed ClickHouse clusters
- Manage ClickHouse Cloud resources
- Install the official ClickHouse agent skills into supported coding agents
- Push your local ClickHouse development to cloud
clickhousectl helps humans and AI-agents to develop with ClickHouse.
Installation
Quick install
~/.local/bin/clickhousectl. A chctl alias is also created automatically for convenience.
Requirements
- macOS (aarch64, x86_64) or Linux (aarch64, x86_64)
- Cloud commands require a ClickHouse Cloud API key
Local
Installing and managing ClickHouse versions
clickhousectl downloads ClickHouse binaries from GitHub releases.
ClickHouse binary storage
ClickHouse binaries are stored in a global repository, so they can be used by multiple projects without duplicating storage. Binaries are stored in~/.clickhousectl/:
Initializing a project
init bootstraps your current working directory with a standard folder structure for your ClickHouse project files. It is optional; you are welcome to use your own folder structure if preferred.
It creates the following structure:
Running queries
Creating and managing ClickHouse servers
Start and manage ClickHouse server instances. Each server gets its own isolated data directory at.clickhousectl/servers/<name>/data/.
--name, the first server is called “default”. If “default” is already running, a random name is generated (e.g. “bold-crane”). Use --name for stable identities you can start/stop repeatedly.
Ports: Defaults are HTTP 8123 and TCP 9000. If these are already in use, free ports are automatically assigned and shown in the output. Use --http-port and --tcp-port to set explicit ports.
Project-local data directory
All server data lives inside.clickhousectl/ in your project directory:
clickhousectl local server remove <name> to permanently delete a server’s data.
Authentication
Authenticate to ClickHouse Cloud using OAuth (browser-based) or API keys.OAuth login (recommended)
.clickhousectl/tokens.json (project-local).
API key/secret
.clickhousectl/credentials.json (project-local).
You can also use environment variables:
Auth status and logout
.clickhousectl/credentials.json > environment variables.
Cloud
Manage ClickHouse Cloud services via the API.Organizations
Services
Service create options
Query endpoint management
Private endpoint management
Backup configuration
Backups
Members
Invitations
Keys
Activity
JSON output
Use the--json flag to print JSON-formatted responses.