#!/bin/sh # Installs Superhound in ~/Applications. Source: https://github.com/PGHQdev/Superhound set -eu fail() { echo "Superhound: $1" >&2; exit 1; } [ "$(uname -s)" = Darwin ] && [ "$(uname -m)" = arm64 ] || fail "needs a Mac with Apple Silicon." [ "$(sw_vers -productVersion | cut -d. -f1)" -ge 15 ] || fail "needs macOS 15 or later." url='https://github.com/PGHQdev/Superhound/releases/download/v0.6.1/Superhound.zip' sum='caa86142e00eeaa08d40f0ad98afbec259032e62fd6ded1ea737f4bcc7bb9e1e' work=$(mktemp -d) trap 'rm -rf "$work"' EXIT echo "Downloading Superhound..." curl -fsSL "$url" -o "$work/Superhound.zip" || fail "the download failed." echo "$sum $work/Superhound.zip" | shasum -a 256 -c - >/dev/null 2>&1 || fail "the download does not match the published checksum." ditto -x -k "$work/Superhound.zip" "$work/new" || fail "the download could not be unpacked." [ -d "$work/new/Superhound.app" ] && codesign --verify --strict "$work/new/Superhound.app" 2>/dev/null || fail "the app in the download is damaged." if pgrep -xq Superhound; then osascript -e 'tell application id "com.superhound.app" to quit' >/dev/null 2>&1 || true i=0; while pgrep -xq Superhound && [ $i -lt 20 ]; do sleep 0.5; i=$((i+1)); done pgrep -xq Superhound && fail "quit Superhound, then run this command again." fi mkdir -p "$HOME/Applications" target="$HOME/Applications/Superhound.app" [ -e "$target" ] && mv "$target" "$work/previous.app" mv "$work/new/Superhound.app" "$target" open "$target" echo "Superhound is installed. Choose Search from the hound in the menu bar."