name: install-datafusion description: > Install or update datafusion-cli. Supports installation via cargo install, Homebrew, or pre-built binaries. Checks the current version and offers to upgrade if outdated. argument-hint: [--update] allowed-tools: Bash
You are helping the user install or update datafusion-cli.
Arguments: $@
Step 1 — Check if datafusion-cli is already installed
command -v datafusion-cli
If found, check the version:
datafusion-cli --version 2>&1 | head -1
Step 2 — Determine the action
- If
--updateis in the arguments and datafusion-cli is installed → update mode - If datafusion-cli is not installed → install mode
- If installed and no
--update→ report the current version and stop
Step 3 — Install or update
Detect the platform and offer the appropriate method:
macOS
Option 1 — Homebrew (recommended if brew is available):
brew install datafusion
Or for update:
brew upgrade datafusion
Option 2 — cargo install (works on all platforms):
cargo install datafusion-cli
Linux
Option 1 — cargo install (recommended):
cargo install datafusion-cli
Option 2 — Download pre-built binary from GitHub releases:
LATEST=$(curl -fsSL https://api.github.com/repos/apache/datafusion/releases/latest | grep -oP '"tag_name": "\K[^"]+')
curl -fsSL "https://github.com/apache/datafusion/releases/download/${LATEST}/datafusion-cli-${LATEST}-x86_64-unknown-linux-gnu.tar.gz" | tar xz
sudo mv datafusion-cli /usr/local/bin/
All platforms — cargo install
If neither brew nor pre-built binaries are suitable:
cargo install datafusion-cli
For update via cargo:
cargo install datafusion-cli --force
Note: cargo install requires a Rust toolchain. If cargo is not found, suggest installing Rust first via rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Step 4 — Verify
datafusion-cli --version
Report success with the installed version.