#!/bin/bash # Idle installer for macOS. Downloads Idle.dmg from the Idle site, checks it, and copies Idle.app to /Applications. # It does nothing else: no sudo, no login items, no LaunchAgents, no shell profile changes. # # Read it before you run it: # curl -fsSL https://idle-games.pages.dev/install.sh -o install.sh && less install.sh && bash install.sh # Or in one go: # curl -fsSL https://idle-games.pages.dev/install.sh | bash # curl -fsSL https://idle-games.pages.dev/install.sh | bash -s -- INVITECODE # # Be aware: Idle is not yet notarised by Apple. A file fetched with curl is not marked "downloaded from the internet", # so macOS skips its Gatekeeper prompt for it (as it does for anything you build yourself). If you would rather macOS # checked it, download Idle.dmg in a browser instead. The SHA-256 below only detects a damaged download; it comes from # the same site, so it is not a guarantee about who published the file. set -euo pipefail HOST="https://idle-games.pages.dev" INVITE="${1:-}" [[ "$INVITE" =~ ^[A-Za-z0-9]{4,12}$ ]] || INVITE="" # only ever a short invite code DEST="${IDLE_DEST:-/Applications}" # override to install somewhere else (used for testing) [ "$(uname -s)" = "Darwin" ] || { echo "Idle only runs on macOS for now."; exit 1; } [ "$(uname -m)" = "arm64" ] || { echo "This build needs an Apple Silicon Mac (M1 or later)."; exit 1; } tmp="$(mktemp -d)" cleanup() { hdiutil detach "$tmp/mnt" -quiet 2>/dev/null || true; rm -rf "$tmp"; } trap cleanup EXIT echo "Downloading Idle..." curl -fsSL "$HOST/download/Idle.dmg" -o "$tmp/Idle.dmg" expected="$(curl -fsSL "$HOST/download/Idle.dmg.sha256" | awk '{print $1}')" actual="$(shasum -a 256 "$tmp/Idle.dmg" | awk '{print $1}')" [ -n "$expected" ] && [ "$expected" = "$actual" ] || { echo "Checksum did not match; stopping."; exit 1; } mkdir "$tmp/mnt" hdiutil attach "$tmp/Idle.dmg" -nobrowse -quiet -mountpoint "$tmp/mnt" if [ -d "$DEST/Idle.app" ]; then osascript -e 'quit app "Idle"' >/dev/null 2>&1 || true sleep 1 rm -rf "$DEST/Idle.app" fi # The app's code signature must be intact (this detects a modified or truncated bundle; it does not identify a publisher). codesign --verify --deep --strict "$tmp/mnt/Idle.app" || { echo "The app's signature did not verify; stopping."; exit 1; } mkdir -p "$DEST" ditto "$tmp/mnt/Idle.app" "$DEST/Idle.app" echo "Installed to $DEST/Idle.app" codesign -dv "$DEST/Idle.app" 2>&1 | grep -E "Identifier|Signature" | sed 's/^/ /' [ -n "${IDLE_NO_OPEN:-}" ] && exit 0 open "$DEST/Idle.app" if [ -n "$INVITE" ]; then sleep 3 open "idle://join/$INVITE" fi