Skip to content

Instantly share code, notes, and snippets.

@cloudcreatordotio
Created April 22, 2026 18:17
Show Gist options
  • Select an option

  • Save cloudcreatordotio/7ead8efe13345e8a5150974feb7b0abb to your computer and use it in GitHub Desktop.

Select an option

Save cloudcreatordotio/7ead8efe13345e8a5150974feb7b0abb to your computer and use it in GitHub Desktop.
Linux bash script to download the latest version of Jetbrains toolbox and install it. Make the script executable (chmod +x) and move it to the ~/.local/bin directory. Run the command "install-toolbox" in a new terminal to begin installation
#!/usr/bin/env bash
set -euo pipefail
API_URL="https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release"
INSTALL_DIR="/opt/jetbrains-toolbox"
echo "Fetching latest Toolbox release info..."
ALL_URLS="$(curl -fsSL "$API_URL" | grep -oP '"link":\s*"\Khttps://download\.jetbrains\.com/toolbox/[^"]+\.tar\.gz')"
case "$(uname -m)" in
x86_64) DOWNLOAD_URL="$(echo "$ALL_URLS" | grep -v -- '-arm64' | head -n1)" ;;
aarch64|arm64) DOWNLOAD_URL="$(echo "$ALL_URLS" | grep -- '-arm64' | head -n1)" ;;
*) echo "Error: unsupported architecture $(uname -m)" >&2; exit 1 ;;
esac
if [[ -z "$DOWNLOAD_URL" ]]; then
echo "Error: could not parse download URL from $API_URL" >&2
exit 1
fi
echo "Latest: $DOWNLOAD_URL"
if pgrep -f jetbrains-toolbox >/dev/null; then
echo "Stopping running Toolbox..."
pkill -f jetbrains-toolbox
sleep 2
fi
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
TARBALL="$TMP_DIR/$(basename "$DOWNLOAD_URL")"
echo "Downloading to $TARBALL..."
curl -fL --progress-bar -o "$TARBALL" "$DOWNLOAD_URL"
echo "Extracting..."
tar -xzf "$TARBALL" -C "$TMP_DIR"
EXTRACTED_BIN="$(find "$TMP_DIR" -mindepth 2 -maxdepth 2 -type d -name bin | head -n1)"
if [[ -z "$EXTRACTED_BIN" ]]; then
echo "Error: could not find bin/ directory in tarball" >&2
exit 1
fi
echo "Replacing $INSTALL_DIR (sudo required)..."
sudo rm -rf "$INSTALL_DIR"
sudo mv "$EXTRACTED_BIN" "$INSTALL_DIR"
echo "Launching Toolbox..."
nohup "$INSTALL_DIR/jetbrains-toolbox" >/dev/null 2>&1 &
disown
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment