Script to install uv


UV’s install instructions tell you to pipe a random web URL into your shell:

curl -LsSf https://astral.sh/uv/install.sh | sh I never to that without inspecting the script first and when I tried that for UV’s install script I was floored, it’s soo complicated. I gave up, instead I wrote my own, covers my use case and probably like the 80% most common installs and is only 3 lines of bash.

#!/bin/bash

# This is a dumb script meant for use by smart humans.
# - Needs curl installed
# - Needs to run as root
# - Set UV_VERSION to the UV version you want to download.
# - Set PLATFORM to the platform you need. Defaults to the one 99% of people use: x86_64-unknown-linux-gnu.
#   The platform is what comes after `uv-` in https://github.com/astral-sh/uv/releases
# - set DEST_DIR to where you want it installed. Defaults to /usr/local.bin

BASE_URL="https://github.com/astral-sh/uv/releases/download"
curl -sSL $BASE_URL/${UV_VERSION?}/uv-${PLATFORM:-x86_64-unknown-linux-gnu}.tar.gz | \
    tar -zxv --strip-components 1 -C ${DEST_DIR:-/usr/local/bin}

I have an on-line version. To run it and fetch the specified UV version for x86_64 Linux and install it in /usr/local/bin:

curl https://www.tomechangosubanana.com/install-uv.sh | sudo UV_VERSION=0.7.2 bash

The destination path, UV version and target platform can be configured with environment variables.

If you want to try it that’s great; if so, do as I do and do curl https://www.tomechangosubanana.com/install-uv.sh to see exactly what you’re running. At least this one is possible to understand!