Skip to content

Instantly share code, notes, and snippets.

@hellt
Created March 4, 2026 13:33
Show Gist options
  • Select an option

  • Save hellt/6bdb2c2c1ac14cfb817a0e6b412fbc16 to your computer and use it in GitHub Desktop.

Select an option

Save hellt/6bdb2c2c1ac14cfb817a0e6b412fbc16 to your computer and use it in GitHub Desktop.
uvx with git+https support
#!/bin/sh
set -eu
UV_INSTALL_DIR="${UV_INSTALL_DIR:-$HOME/.local/bin}"
if command -v uv >/dev/null 2>&1; then
UV_BIN="uv"
elif [ -x "$UV_INSTALL_DIR/uv" ]; then
UV_BIN="$UV_INSTALL_DIR/uv"
else
echo "Installing uv..."
if command -v curl >/dev/null 2>&1; then
fetch_cmd="curl -LsSf"
elif command -v wget >/dev/null 2>&1; then
fetch_cmd="wget -qO-"
else
echo "error: need 'curl' or 'wget' (commands not found)" >&2
exit 1
fi
$fetch_cmd https://astral.sh/uv/install.sh | sh
UV_BIN="$UV_INSTALL_DIR/uv"
fi
echo "Installing foo@latest..."
"$UV_BIN" tool install "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment