Mise En Place: Installing DuckDB

Problem

You need to get the DuckDB CLI onto a system.

Solution

Strongly consider using a direct download approach.

Discussion

While some environments have added DuckDB to their package manager, this is not the case for all. As a result, I find it easier to just download the binary and put it in a directory that is in your path.

For Windows, macOS, and Linux there are individual ZIP archives for the CLI, drivers, and libraries, making it pretty straightforward to build a cross-platform workflow for doing so:

curl \
  --silent \
  --url "https://api.github.com/repos/duckdb/duckdb/releases/latest" | \
  jq -r '.assets[] | .browser_download_url'
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_cli-linux-aarch64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_cli-linux-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_cli-osx-universal.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_cli-windows-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_jdbc-linux-aarch64.jar
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_jdbc-linux-amd64.jar
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_jdbc-osx-universal.jar
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_jdbc-windows-amd64.jar
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_odbc-linux-aarch64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_odbc-linux-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_odbc-osx-universal.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_odbc-windows-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_python_src.tar.gz
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-linux-aarch64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-linux-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-osx-universal.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-src.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-windows-amd64.zip

Not to get ahead of ourselves, but – once you have the DuckDB on a system – you can use it vs. the curl + jq operations, to perform the same operation:

duckdb -noheader -list -c "
WITH assets AS (
  FROM read_json('https://api.github.com/repos/duckdb/duckdb/releases/latest') 
  SELECT
    UNNEST(assets) rec
)
FROM assets
SELECT
  rec.browser_download_url
"
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_cli-linux-aarch64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_cli-linux-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_cli-osx-universal.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_cli-windows-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_jdbc-linux-aarch64.jar
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_jdbc-linux-amd64.jar
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_jdbc-osx-universal.jar
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_jdbc-windows-amd64.jar
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_odbc-linux-aarch64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_odbc-linux-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_odbc-osx-universal.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_odbc-windows-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/duckdb_python_src.tar.gz
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-linux-aarch64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-linux-amd64.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-osx-universal.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-src.zip
https://github.com/duckdb/duckdb/releases/download/v0.10.1/libduckdb-windows-amd64.zip

You can use grep, rg (ripgrep), jq idioms, or SQL (if you go the DuckDB route) to filter for your platform and download the appropriate archive.

DuckDB ships as a single binary, so there’s no need to have a different installation idiom on each platform. This simplifies the process and also any documentation you may need to write for you or your team.

Package managers can also lag behind days or weeks for each new DuckDB release, and there are usually some pretty handy features in the updates that warrant getting in on the action early