#!/bin/bash # Outbox installer. curl -fsSL https://outboxai.co.in/install.sh | bash # # Why this exists: Outbox is signed with our own certificate, not notarized by # Apple, so a copy downloaded in a browser is quarantined and macOS refuses to # open it until you approve it in System Settings. A file fetched with curl is # not quarantined, so installing this way opens normally. This script does # nothing a manual install doesn't: download, check, copy to /Applications. # # Read it before you run it. It needs no password and never uses sudo. set -euo pipefail REPO="Lakshay-dang/outbox-releases" BASE="https://github.com/$REPO/releases/latest/download" DEST_DIR="${OUTBOX_INSTALL_DIR:-/Applications}" APP="$DEST_DIR/Outbox.app" say() { printf '%s\n' "$*"; } fail() { printf 'Outbox install failed: %s\n' "$*" >&2; exit 1; } [ "$(uname -s)" = "Darwin" ] || fail "Outbox is a macOS app." [ "$(uname -m)" = "arm64" ] || fail "this build needs an Apple Silicon Mac (M1 or later)." major="$(sw_vers -productVersion | cut -d. -f1)" [ "$major" -ge 12 ] || fail "macOS 12 or newer is required (this Mac has $(sw_vers -productVersion))." [ -w "$DEST_DIR" ] || fail "cannot write to $DEST_DIR. Set OUTBOX_INSTALL_DIR to a folder you own, e.g. ~/Applications." WORK="$(mktemp -d)" MOUNT="" cleanup() { [ -n "$MOUNT" ] && hdiutil detach "$MOUNT" -quiet 2>/dev/null || true rm -rf "$WORK" } trap cleanup EXIT say "Downloading Outbox…" curl -fL --progress-bar -o "$WORK/Outbox.dmg" "$BASE/Outbox-arm64.dmg" || fail "download failed." # The checksum is published next to the installer. If a release has none, say # so rather than pretend the file was checked. if curl -fsSL -o "$WORK/sum" "$BASE/Outbox-arm64.dmg.sha256" 2>/dev/null; then want="$(awk '{print $1}' "$WORK/sum")" got="$(shasum -a 256 "$WORK/Outbox.dmg" | awk '{print $1}')" [ "$want" = "$got" ] || fail "checksum mismatch — the download is corrupt or was altered. Nothing was installed." say "Checksum verified." else say "Note: this release publishes no checksum, so the download was not verified." fi MOUNT="$(hdiutil attach "$WORK/Outbox.dmg" -nobrowse -readonly -noautoopen 2>/dev/null | awk -F'\t' '/\/Volumes\//{print $NF}' | tail -1)" [ -d "$MOUNT/Outbox.app" ] || fail "the disk image did not contain Outbox.app." codesign --verify --deep --strict "$MOUNT/Outbox.app" 2>/dev/null || fail "the app's signature is broken. Nothing was installed." # Replace an existing copy rather than leave "Outbox 2.app" beside it: two # copies share one bundle ID, which confuses permissions and the keychain. # Only the copy running in THIS login session can be quit from here. On a Mac # with more than one account, another user's copy is out of reach; waiting on # it would fail every time, so say so and carry on. ME="$(id -u)" if pgrep -u "$ME" -qf "$APP/Contents/MacOS/Outbox"; then say "Quitting the running Outbox…" osascript -e 'tell application id "com.outbox.app" to quit' 2>/dev/null || true for _ in 1 2 3 4 5 6 7 8 9 10; do pgrep -u "$ME" -qf "$APP/Contents/MacOS/Outbox" || break; sleep 1; done pgrep -u "$ME" -qf "$APP/Contents/MacOS/Outbox" && fail "Outbox is still running. Quit it and run this again." fi OTHER_USERS="$(ps -axo user=,command= | awk -v me="$(id -un)" -v exe="$APP/Contents/MacOS/Outbox" '$1 != me && index($0, exe) { print $1 }' | sort -u | paste -sd, -)" rm -rf "$DEST_DIR/Outbox.app.new" cp -R "$MOUNT/Outbox.app" "$DEST_DIR/Outbox.app.new" rm -rf "$APP" mv "$DEST_DIR/Outbox.app.new" "$APP" xattr -dr com.apple.quarantine "$APP" 2>/dev/null || true version="$(defaults read "$APP/Contents/Info" CFBundleShortVersionString 2>/dev/null || echo '?')" say "Installed Outbox $version to $APP" if [ -n "$OTHER_USERS" ]; then say "Note: Outbox is also running for another account on this Mac ($OTHER_USERS). That copy keeps running the old version until it is quit there." fi if [ -z "${OUTBOX_NO_OPEN:-}" ]; then open "$APP"; say "Opening it now. macOS will ask for the microphone the first time you hold the capture key."; fi