From e6d87976bb65e59a06dea868efb8585209f309e9 Mon Sep 17 00:00:00 2001 From: Winner Edwin <113316417+mikelneonedwin@users.noreply.github.com> Date: Fri, 23 Jan 2026 17:26:01 +0100 Subject: [PATCH] Allow specifying ZED_VERSION with fallback to latest in `install.sh` (#45522) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR updates the Linux install script to support installing a specific version of Zed via the ZED_VERSION environment variable. - If ZED_VERSION is set, that version will be downloaded. - If ZED_VERSION is not set, the script defaults to the latest stable version, preserving existing behavior. - Works for both Linux and macOS installs. - Maintains compatibility with ZED_CHANNEL for preview builds. This enhancement allows users to: - Pin a specific Zed version for reproducible setups or CI workflows. - Easily install older or known-good versions without manually downloading release assets. Usage examples: - Install latest stable (default): curl -f https://zed.dev/install.sh | sh - Install specific version: curl -f https://zed.dev/install.sh | ZED_VERSION=0.216.0 sh Use this — it’s correct, concise, and clearly user-facing: Release Notes * **Added:** Support for installing a specific Zed version via the `ZED_VERSION` environment variable in the install script (defaults to `latest` when unset). --- docs/src/installation.md | 10 ++++++++++ script/install.sh | 11 ++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/src/installation.md b/docs/src/installation.md index 7d2009e3a0266160ce4e13056287c36ef7660008..a1ebd206016436f65b992edfb21ab25df420fce2 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -36,6 +36,16 @@ For most Linux users, the easiest way to install Zed is through our installation curl -f https://zed.dev/install.sh | sh ``` +You can now optionally specify a **version** of Zed to install using the `ZED_VERSION` environment variable: + +```sh +# Install the latest stable version (default) +curl -f https://zed.dev/install.sh | sh + +# Install a specific version +curl -f https://zed.dev/install.sh | ZED_VERSION=0.216.0 sh +``` + If you'd like to help us test our new features, you can also install our preview build: ```sh diff --git a/script/install.sh b/script/install.sh index 0c2cfa1b74e9818a53cda785b3f431c46a0a0437..1718b1d28284c80cf4d6eb26f6a433d0c2c6e35b 100755 --- a/script/install.sh +++ b/script/install.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh set -eu -# Downloads the latest tarball from https://zed.dev/releases and unpacks it +# Downloads a tarball from https://zed.dev/releases and unpacks it # into ~/.local/. If you'd prefer to do this manually, instructions are at # https://zed.dev/docs/linux. @@ -9,6 +9,7 @@ main() { platform="$(uname -s)" arch="$(uname -m)" channel="${ZED_CHANNEL:-stable}" + ZED_VERSION="${ZED_VERSION:-latest}" # Use TMPDIR if available (for environments with non-standard temp directories) if [ -n "${TMPDIR:-}" ] && [ -d "${TMPDIR}" ]; then temp="$(mktemp -d "$TMPDIR/zed-XXXXXX")" @@ -81,8 +82,8 @@ linux() { if [ -n "${ZED_BUNDLE_PATH:-}" ]; then cp "$ZED_BUNDLE_PATH" "$temp/zed-linux-$arch.tar.gz" else - echo "Downloading Zed" - curl "https://cloud.zed.dev/releases/$channel/latest/download?asset=zed&arch=$arch&os=linux&source=install.sh" > "$temp/zed-linux-$arch.tar.gz" + echo "Downloading Zed version: $ZED_VERSION" + curl "https://cloud.zed.dev/releases/$channel/$ZED_VERSION/download?asset=zed&arch=$arch&os=linux&source=install.sh" > "$temp/zed-linux-$arch.tar.gz" fi suffix="" @@ -134,8 +135,8 @@ linux() { } macos() { - echo "Downloading Zed" - curl "https://cloud.zed.dev/releases/$channel/latest/download?asset=zed&os=macos&arch=$arch&source=install.sh" > "$temp/Zed-$arch.dmg" + echo "Downloading Zed version: $ZED_VERSION" + curl "https://cloud.zed.dev/releases/$channel/$ZED_VERSION/download?asset=zed&os=macos&arch=$arch&source=install.sh" > "$temp/Zed-$arch.dmg" hdiutil attach -quiet "$temp/Zed-$arch.dmg" -mountpoint "$temp/mount" app="$(cd "$temp/mount/"; echo *.app)" echo "Installing $app"