Skip to content

Instantly share code, notes, and snippets.

@yooakim
Last active February 15, 2024 07:13
Show Gist options
  • Save yooakim/276cbdebd841b5def31fdac3cb533f17 to your computer and use it in GitHub Desktop.
Save yooakim/276cbdebd841b5def31fdac3cb533f17 to your computer and use it in GitHub Desktop.
Download duckdb CLI (Linux)
# Set the GitHub API URL for the latest release of duckdb
API_URL="https://api.github.com/repos/duckdb/duckdb/releases/latest"
# Use curl to fetch the latest release data and grep to extract the asset's browser_download_url
DOWNLOAD_URL=$(curl -s $API_URL | grep -oP '"browser_download_url": "\K(.*duckdb_cli-linux-amd64.zip)')
# Download the latest release using the extracted URL
curl -L $DOWNLOAD_URL -o duckdb_cli-linux-amd64.zip
# Create the target directory if it doesn't exist
mkdir -p $HOME/.local/bin
# Unpack the zip file directly into the target directory, overwrite quietly if exists
unzip -o -q duckdb_cli-linux-amd64.zip -d $HOME/.local/bin
# Remove the downloaded zip file
rm duckdb_cli-linux-amd64.zip
# Ensure duckdb is executable
chmod +x $HOME/.local/bin/duckdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment