#!/bin/sh # Installs or updates Instant Answer on macOS: # curl -fsSL https://instant-answer.werkstatt.works/install.sh | sh # # The app isn't notarized by Apple, so a browser download would be blocked by Gatekeeper. Files # downloaded with curl aren't marked as coming from the internet, so the app opens normally. set -eu SITE=https://instant-answer.werkstatt.works PLATFORM=darwin-aarch64 APP="Instant Answer.app" fail() { echo "$*" >&2; exit 1; } [ "$(uname -s)" = Darwin ] || fail "This installer is for macOS. Other systems: $SITE/download/" [ "$(uname -m)" = arm64 ] || fail "Instant Answer needs a Mac with Apple silicon (M1 or newer)." [ "$(sw_vers -productVersion | cut -d. -f1)" -ge 26 ] || fail "Instant Answer needs macOS 26 or newer." work=$(mktemp -d) trap 'rm -rf "${work}"' EXIT curl -fsSL "$SITE/downloads/$PLATFORM/latest.json" -o "${work}/latest.json" || fail "Could not reach $SITE." version=$(plutil -extract version raw -o - "${work}/latest.json") url=$(plutil -extract "platforms.$PLATFORM.url" raw -o - "${work}/latest.json") echo "Downloading Instant Answer ${version}..." curl -fL --progress-bar "$url" -o "${work}/app.tar.gz" tar -xzf "${work}/app.tar.gz" -C "${work}" [ -d "${work}/$APP" ] || fail "The download is incomplete, please try again." # /Applications if writable (admin users), otherwise the user's own Applications folder. target=/Applications [ -w "${target}" ] || target="$HOME/Applications" mkdir -p "${target}" osascript -e 'quit app "Instant Answer"' >/dev/null 2>&1 || true rm -rf "${target:?}/$APP" mv "${work}/$APP" "${target}/" echo "Installed Instant Answer ${version} in ${target}. Starting it..." open "${target}/$APP" echo "Instant Answer runs in the menu bar. It updates itself from now on."