# duckfetch: a DuckDB manager for Linux (maybe Windows and MacOS)
[](https://crates.io/crates/duckfetch) [](https://opensource.org/licenses/Apache-2.0)   [](https://github.com/PMassicotte/duckfetch/actions/workflows/test-linux-install.yml) [](https://github.com/PMassicotte/duckfetch/actions/workflows/test-macos-install.yml) [](https://github.com/PMassicotte/duckfetch/actions/workflows/test-windos-install.yml)
A simple Rust application to manage DuckDB installations, allowing users to list available versions and install specific versions easily.
## Table of Contents
- [Demo](#demo)
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Check the currently installed DuckDB version](#check-the-currently-installed-duckdb-version)
- [List available DuckDB versions](#list-available-duckdb-versions)
- [Install DuckDB](#install-duckdb)
- [Help](#help)
- [Autocompletion](#autocompletion)
- [Other related projects](#other-related-projects)
## Demo

## Features
- List available DuckDB versions from GitHub releases with `duckfetch list`.
- Install a specific DuckDB version with `duckfetch install`.
- Update to the latest version with `duckfetch update`.
- Generate auto-completion scripts for your shell with `duckfetch completions`.
## Requirements
- [Rust](https://www.rust-lang.org/tools/install) (version 1.60 or later)
- Internet access to download DuckDB releases.
## Installation
You can install `duckfetch` using `cargo`, the Rust package manager, or by using the provided shell scripts.
### Cargo
To install it from crates.io:
```bash
cargo install duckfetch
```
Or the development version:
```bash
cargo install --git https://github.com/pmassicotte/duckfetch
```
### Shell scripts
Linux and MacOS:
```bash
curl --proto '=https' --tlsv1.2 -LsSf $(curl -s https://api.github.com/repos/pmassicotte/duckfetch/releases/latest | grep -o 'https://github.com/pmassicotte/duckfetch/releases/download/[^"]*-installer.sh') | sh
```
Windows:
```powershell
powershell -ExecutionPolicy Bypass -c "$url = (Invoke-RestMethod -Uri 'https://api.github.com/repos/pmassicotte/duckfetch/releases/latest').assets | Where-Object { $_.name -eq 'duckfetch-installer.ps1' } | Select-Object -ExpandProperty browser_download_url; irm $url | iex"
```
## Usage
### Check the currently installed DuckDB version
```bash
duckfetch check
```
### List available DuckDB versions
```bash
duckfetch list
```
### Install DuckDB
This command will print the available versions and ask the user to select one to install.
```bash
duckfetch install
```
### Open the change log of the latest DuckDB version
This will open the GitHub release page for the latest DuckDB version in your default browser.
```bash
duckfetch changelog
```
## Help
For more information, use the `--help` flag:
```bash
duckfetch install --help
```
## Autocompletion
To enable autocompletion, you can use the `completions` subcommand to generate the completion script for your shell. For example, to enable completions for the `zsh` shell:
```bash
duckfetch completions zsh >~/.zfunc/_duckfetch
```
Then, add the following line to your `.zshrc` file:
```bash
fpath+=~/.zfunc
autoload -Uz compinit
compinit -i
```
## Troubleshooting
### GitHub API Rate Limits
If you encounter GitHub API rate limit errors (especially in CI/CD or with heavy usage), you can set a `GITHUB_TOKEN` environment variable to increase your rate limit:
```bash
export GITHUB_TOKEN=your_github_token_here
duckfetch update
```
To create a GitHub token:
1. Go to GitHub Settings → Developer settings → Personal access tokens
2. Generate a new token (no special permissions needed for public repositories)
3. Set the token as an environment variable
## Other related projects
- https://github.com/NiclasHaderer/duckdb-version-manager
- https://github.com/carlopi/duckdb-latest