Skip to main content

DuckDB CLI

Installation

note

MotherDuck supports DuckDB client versions 1.4.1 through 1.5.5 in all regions. For the range each region supports, see client version support.

Download and install the DuckDB binary, depending on your operating system.

The recommended way to install the CLI is with the MotherDuck install script:

Install with PowerShell

powershell -c "irm https://install.motherduck.com | iex"

The script installs a MotherDuck-supported DuckDB version to %LOCALAPPDATA%\duckdb\cli, installs the motherduck extension, and can fetch and persist a MotherDuck token.

If your PowerShell execution policy blocks the command above, use the cmd.exe fallback:

curl -sfL -o install.bat https://install.motherduck.com/install.bat && install.bat

The cmd.exe script installs the windows-amd64 build only and cannot run the interactive token flow. On ARM64, or to use the token flow, use the PowerShell script.

Download the binary

To install manually instead:

  1. Download the 64-bit Windows binary duckdb_cli-windows-amd64.zip
  2. Extract the zip file.

For more information, see the DuckDB installation documentation.

Try it

Walk through starting DuckDB, attaching MotherDuck, and running your first query in the playground below. Each step explains what happens before you press Enter, so you can preview the full flow before running it on your machine.

DuckDB CLI
MotherDuck DuckDB CLI emulator
Type duckdb to start a local DuckDB session in the browser. Then attach MotherDuck with ATTACH 'md:';.
$
Not started

Step by step

Start the DuckDB CLI

After installing, start DuckDB from your terminal:

duckdb

DuckDB opens an in-memory database by default, so any tables you create won't persist when you exit. Pass a filename to open or create a persistent local database:

duckdb mydatabase.duckdb

Connect to MotherDuck

From inside the DuckDB CLI, attach MotherDuck:

ATTACH 'md:';

DuckDB downloads the signed MotherDuck extension and opens your default browser to authenticate. Follow the instructions in the terminal.

To list your MotherDuck databases and confirm the connection, run:

SHOW DATABASES;

You can query local DuckDB data and MotherDuck databases from the same session.

For more on persisting your authentication credentials, see Authenticating to MotherDuck.

tip

You can also connect to MotherDuck directly when starting DuckDB:

duckdb "md:"
Manual extension update

When MotherDuck releases a new extension version you can force-reinstall the extension from the CLI.

FORCE INSTALL motherduck;

Open the MotherDuck UI from the CLI

Launch the MotherDuck UI from your terminal:

duckdb -ui

If you're already in a DuckDB session, run CALL start_ui(); instead.