#!/bin/bash # Unstumped installer: curl -fsSL https://unstumped.app/install | bash # Downloads the latest Unstumped, checks it wasn't tampered with, puts it in Applications and opens it. set -euo pipefail SERVER="https://unstumped.app" bold() { printf "\033[1m%s\033[0m\n" "$1"; } fail() { printf "\n\033[31m%s\033[0m\n" "$1" >&2; exit 1; } bold "Installing Unstumped…" MAJOR=$(sw_vers -productVersion | cut -d. -f1) [ "$MAJOR" -ge 14 ] || fail "Unstumped needs macOS 14 (Sonoma) or newer. This Mac has $(sw_vers -productVersion)." TMP=$(mktemp -d) trap 'rm -rf "$TMP"' EXIT echo " Finding the latest version…" curl -fsSL "$SERVER/releases/latest.json" -o "$TMP/latest.json" || fail "Couldn't reach Unstumped's server. Check your internet connection and try again." VERSION=$(plutil -extract version raw -o - "$TMP/latest.json") ZIP_PATH=$(plutil -extract zip raw -o - "$TMP/latest.json") SHA=$(plutil -extract sha256 raw -o - "$TMP/latest.json") # Braces matter: bash without a UTF-8 locale would read "…" as part of the variable name. echo " Downloading Unstumped ${VERSION}…" curl -fL --progress-bar "$SERVER$ZIP_PATH" -o "$TMP/Unstumped.zip" || fail "The download failed. Try again." [ "$(shasum -a 256 "$TMP/Unstumped.zip" | cut -d' ' -f1)" = "$SHA" ] || fail "The download was damaged. Try again." ditto -x -k "$TMP/Unstumped.zip" "$TMP/unpacked" || fail "Couldn't unpack Unstumped." DEST=/Applications if [ ! -w "$DEST" ]; then DEST="$HOME/Applications" mkdir -p "$DEST" fi if pgrep -xq Unstumped; then echo " Closing the running copy of Unstumped…" osascript -e 'quit app "Unstumped"' >/dev/null 2>&1 || pkill -x Unstumped || true sleep 1 fi echo " Moving Unstumped to ${DEST}…" rm -rf "$DEST/Unstumped.app" mv "$TMP/unpacked/Unstumped.app" "$DEST/Unstumped.app" echo bold "✓ Unstumped $VERSION is installed and opening." echo " Look for the speech-bubble icon in your menu bar." open "$DEST/Unstumped.app"