#!/bin/sh # distro for macOS ยท https://distro.digital/download # Usage: curl -fsSL https://distro.digital/install | sh set -eu BASE="https://download.distro.digital/mac" TEAM_ID="29496YFAB9" BUNDLE_ID="digital.distro.desktop" say() { printf '\033[1mdistro\033[0m %s\n' "$*"; } fail() { printf '\033[31mdistro %s\033[0m\n' "$*" >&2; exit 1; } [ "$(uname -s)" = "Darwin" ] || fail "This installer is for macOS. The Windows app is coming soon: https://distro.digital/download" # hw.optional.arm64 is 1 on Apple silicon, also when this shell runs under Rosetta. if [ "$(sysctl -n hw.optional.arm64 2>/dev/null || echo 0)" = "1" ]; then ARCH=arm64 else fail "distro needs a Mac with Apple silicon (M1 or later) for now. Intel Macs are coming."; fi TMP="$(mktemp -d)" MNT="$TMP/mnt" cleanup() { hdiutil detach "$MNT" -quiet >/dev/null 2>&1 || true; rm -rf "$TMP"; } trap cleanup EXIT INT TERM say "Downloading the latest version..." curl -fL --progress-bar -o "$TMP/distro.dmg" "$BASE/distro-latest-$ARCH.dmg" || fail "Download failed. Check your connection and try again." hdiutil attach "$TMP/distro.dmg" -nobrowse -readonly -mountpoint "$MNT" -quiet || fail "Couldn't open the disk image." APP="$MNT/distro.app" [ -d "$APP" ] || fail "The disk image has no distro.app." say "Checking Apple's signature..." codesign --verify --deep --strict "$APP" 2>/dev/null || fail "The app's signature is broken. Not installing." codesign -dv --verbose=2 "$APP" 2>&1 | grep -q "TeamIdentifier=$TEAM_ID" || fail "The app isn't signed by distro. Not installing." spctl -a -t exec "$APP" 2>/dev/null || fail "macOS doesn't accept this app as notarized. Not installing." DEST="${DISTRO_INSTALL_DIR:-/Applications}" if [ ! -w "$DEST" ]; then DEST="$HOME/Applications"; mkdir -p "$DEST"; fi # Quit a running copy first, so it isn't replaced while open. if pgrep -f "distro.app/Contents/MacOS/distro" >/dev/null 2>&1; then say "Quitting the running copy..." osascript -e "tell application id \"$BUNDLE_ID\" to quit" >/dev/null 2>&1 || true i=0; while pgrep -f "distro.app/Contents/MacOS/distro" >/dev/null 2>&1 && [ $i -lt 40 ]; do sleep 0.25; i=$((i+1)); done fi say "Installing to $DEST..." rm -rf "$DEST/distro.app" ditto "$APP" "$DEST/distro.app" || fail "Couldn't copy distro.app to $DEST." VERSION="$(defaults read "$DEST/distro.app/Contents/Info" CFBundleShortVersionString 2>/dev/null || echo "")" say "Installed distro ${VERSION} in $DEST. It updates itself from now on." say "Next: open distro, sign in, and connect your AI (Claude Code, Codex, Cursor or Grok)." if [ -z "${DISTRO_NO_OPEN:-}" ]; then open "$DEST/distro.app" || true; fi