The Malloy CLI is a command-line interface for running .malloysql and .malloy files. It can be used to automate transformations, build simple pipelines, or even integrate compiled Malloy SQL into other applications.
Installation
You can download the latest release of the Malloy-CLI from here.
If you have npm/npx installed, you can also run the CLI by either installing it (npm install -g malloy-cli) or using npx to run it npx malloy-cli {your command here}
Mac users
Please note that the CLI is currently not notarized (this is a work in progress). Running the CLI binary downloaded from our download link requires opening Privacy and Security MacOS settings and explicitly allowing it.
Setup
The CLI stores connection configuration in ~/.config/malloy/malloy-config.json. This file uses the shared malloy-config.json format described in the Configuration documentation.
For detailed setup instructions including environment variables, connection commands, and database-specific configuration, see CLI Setup.
Default Connections
If a connection name in your model matches a registered database type (DuckDB, BigQuery, Postgres, Snowflake, Trino, or Presto), the CLI creates one with default settings automatically. For example, duckdb.table('data.parquet') works out of the box. Some database types rely on environment variables for their defaults (e.g. SNOWFLAKE_ACCOUNT, TRINO_SERVER) — see the Configuration reference for the full list of defaults per connection type.
Usage
The main commands of the CLI are run and compile — run executes queries and returns results, whereas compile returns SQL for a query or many queries.
The CLI has detailed usage information for each command. You can get general help with malloy-cli --help, and command-specific help and options with malloy-cli {command} --help
Using the CLI with VS Code
When using malloy-cli build alongside the Malloy VS Code extension, both tools need to share the same config file so they read and write the same manifest. There are two ways to set this up:
Global config (simplest): The CLI uses ~/.config/malloy/malloy-config.json by default — no flags needed. Point VS Code's malloy.globalConfigDirectory setting at ~/.config/malloy. Both tools share the manifest at ~/.config/malloy/MANIFESTS/malloy-manifest.json.
Project config: Put malloy-config.json at your project root. VS Code finds it automatically. Pass --config . (or --config <project-dir>) to the CLI. Both tools share the manifest at <project>/MANIFESTS/malloy-manifest.json. This keeps everything project-local.