#!/bin/sh # Install p8 (https://8intuition.com) with one command: # # curl -fsSL https://8intuition.com/install.sh | sh # # What this script does — it is short, read it first if you like: # 1. Picks the p8 build for this computer: macOS 13+ (Apple Silicon or Intel), or Linux # (x86_64 or arm64, when there is a build for it). Windows: use install.ps1 (below). # 2. Downloads it over HTTPS from download.8intuition.com (the same file as the Download button). # 3. macOS: checks the app's identity and signature, copies p8.app into /Applications # (or ~/Applications when /Applications is not writable), and opens p8. # An older p8 is asked to quit first, the same way the Quit menu does. # Linux: installs the .deb or .rpm with your package manager (asks for sudo), else the AppImage # into ~/.local/bin. # No admin password on macOS. Nothing else on your system is changed. Your boards and settings stay. # # Options (environment variables, e.g. `curl -fsSL https://8intuition.com/install.sh | P8_NO_OPEN=1 sh`): # P8_INSTALL_DIR= install p8.app into this folder instead of /Applications (macOS) # P8_NO_OPEN=1 do not open p8 when the install is done # # Windows (PowerShell): irm https://8intuition.com/install.ps1 | iex # # Uninstall: macOS: quit p8 and move it from Applications to the Bin. Linux: remove the p8 package # (apt / dnf), or delete ~/.local/bin/p8.AppImage and ~/.local/share/applications/p8.desktop. # Everything runs inside main(), so a download cut off halfway runs nothing. main() { set -u BASE="${P8_INSTALL_BASE:-https://account.8intuition.com}" SITE="https://8intuition.com" APP_ID="com.8intuition.p8" TMP="" MOUNT="" if [ -t 1 ]; then B="$(printf '\033[1m')"; D="$(printf '\033[2m')"; G="$(printf '\033[32m')"; R="$(printf '\033[31m')"; T="$(printf '\033[36m')"; N="$(printf '\033[0m')" else B=""; D=""; G=""; R=""; T=""; N="" fi trap cleanup EXIT trap 'exit 130' INT TERM printf '\n %sp8%s installer %s· 8intuition.com%s\n\n' "$T$B" "$N$B" "$D" "$N" case "$(uname -s)" in Darwin) install_mac ;; Linux) install_linux ;; MINGW* | MSYS* | CYGWIN*) die "This is the macOS and Linux installer. On Windows, run this in PowerShell: irm $SITE/install.ps1 | iex" ;; *) die "p8 runs on macOS, Windows and Linux. See $SITE/p8/download" ;; esac } step() { printf ' %s→%s %s\n' "$T" "$N" "$*"; } note() { printf ' %s%s%s\n' "$D" "$*" "$N"; } die() { printf '\n %s✕%s %s\n\n' "$R" "$N" "$*" >&2; exit 1; } cleanup() { if [ -n "${MOUNT:-}" ] && [ -d "$MOUNT" ]; then hdiutil detach -quiet "$MOUNT" >/dev/null 2>&1 || hdiutil detach -quiet -force "$MOUNT" >/dev/null 2>&1; fi if [ -n "${TMP:-}" ] && [ -d "$TMP" ]; then rm -rf "$TMP"; fi } need() { command -v "$1" >/dev/null 2>&1 || die "This installer needs '$1', which is missing on this computer."; } # resolve → prints where /dl/p8/ leads (a HEAD request, not counted). A platform # without a build leads to the site's download page instead of an installer file. resolve() { curl -fsSIL --proto '=https' --proto-redir '=https' --tlsv1.2 --retry 2 -o /dev/null -w '%{url_effective}' \ -A "p8-install/1 ($(uname -s) $(uname -m))" "$BASE/dl/p8/$1" || die "Could not reach 8intuition.com. Check your connection and run the command again." } # download → prints the final URL. The account service counts the download and # redirects to the current build; a platform without a build redirects to the site's download page. download() { if [ -t 2 ]; then progress="-#"; else progress="-sS"; fi curl -fL $progress --proto '=https' --proto-redir '=https' --tlsv1.2 --retry 2 \ -A "p8-install/1 ($(uname -s) $(uname -m))" -w '%{url_effective}' -o "$2" "$BASE/dl/p8/$1" || die "The download failed. Check your connection and run the command again, or download p8 from $SITE/p8/download" } install_mac() { need curl; need hdiutil; need ditto; need codesign macos="$(sw_vers -productVersion 2>/dev/null || echo 0)" major="${macos%%.*}" [ "${major:-0}" -ge 13 ] 2>/dev/null || die "p8 needs macOS 13 Ventura or later. This Mac has macOS $macos." # A Terminal running under Rosetta reports x86_64 on an Apple Silicon Mac. arch="$(uname -m)" if [ "$arch" = "x86_64" ] && [ "$(sysctl -in sysctl.proc_translated 2>/dev/null)" = "1" ]; then arch="arm64"; fi case "$arch" in arm64) platform="mac"; kind="Apple Silicon" ;; x86_64) platform="mac-intel"; kind="Intel" ;; *) die "Unknown Mac processor: $arch." ;; esac TMP="$(mktemp -d "${TMPDIR:-/tmp}/p8-install.XXXXXX")" || die "Could not create a temporary folder." url="$(resolve "$platform")" || exit 1 case "$url" in *.dmg) ;; *) die "No p8 build for this Mac right now. See $SITE/p8/download" ;; esac step "Downloading p8 for macOS ($kind)" download "$platform" "$TMP/p8.dmg" >/dev/null step "Checking the app" MOUNT="$TMP/mnt" mkdir -p "$MOUNT" hdiutil attach -nobrowse -readonly -noautoopen -quiet -mountpoint "$MOUNT" "$TMP/p8.dmg" >/dev/null 2>&1 || die "The downloaded file is damaged. Run the command again." src="$MOUNT/p8.app" [ -d "$src" ] || die "The download has no p8.app in it. Run the command again, or download p8 from $SITE/p8/download" id="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$src/Contents/Info.plist" 2>/dev/null)" [ "$id" = "$APP_ID" ] || die "The downloaded app is not p8 ($id). Nothing was installed." codesign --verify --strict "$src" >/dev/null 2>&1 || die "p8's signature does not check out. Nothing was installed. Please tell us: 1@8intuition.com" version="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$src/Contents/Info.plist" 2>/dev/null)" dir="${P8_INSTALL_DIR:-/Applications}" if [ -z "${P8_INSTALL_DIR:-}" ] && [ ! -w "$dir" ]; then dir="$HOME/Applications" note "/Applications is not writable for your user, so p8 goes to ~/Applications." fi mkdir -p "$dir" || die "Could not create $dir." app="$dir/p8.app" old="" if [ -d "$app" ]; then old="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$app/Contents/Info.plist" 2>/dev/null || true)" if pgrep -f "^$app/Contents/MacOS/" >/dev/null 2>&1; then step "Quitting the open p8 so it can be updated" osascript -e "tell application \"$app\" to quit" >/dev/null 2>&1 || true i=0 while pgrep -f "^$app/Contents/MacOS/" >/dev/null 2>&1; do i=$((i + 1)) [ "$i" -le 30 ] || die "p8 is still open (it may be asking you something). Quit p8, then run the command again." sleep 1 done fi fi step "Installing p8 $version into $dir" rm -rf "$dir/.p8.app.installing" ditto "$src" "$dir/.p8.app.installing" || { rm -rf "$dir/.p8.app.installing"; die "Could not copy p8 into $dir."; } rm -rf "$app" && mv "$dir/.p8.app.installing" "$app" || die "Could not replace $app. Move the old p8 to the Bin and run the command again." printf '\n %s✓%s %sp8 %s is installed%s' "$G" "$N" "$B" "$version" "$N" if [ -n "$old" ] && [ "$old" != "$version" ]; then printf ' %s(was %s)%s' "$D" "$old" "$N"; fi printf '\n' note "It's in $dir, Launchpad and Spotlight. p8 updates itself from now on." if [ -z "$old" ]; then note "Your 10-day free trial starts when p8 opens. No card, no account."; fi note "Bought a license? Click “Open p8” in your welcome email, or paste your key in p8." if [ -z "${P8_NO_OPEN:-}" ]; then open "$app" >/dev/null 2>&1 && note "Opening p8…" || note "Open p8 from Applications." fi printf '\n' } # Linux: the .deb or .rpm through the package manager when sudo is available, else the AppImage. install_linux() { need curl case "$(uname -m)" in x86_64 | amd64) sfx="" ;; aarch64 | arm64) sfx="-arm64" ;; *) die "p8 for Linux needs an x86_64 or arm64 computer. This one is $(uname -m)." ;; esac sudo="" if [ "$(id -u)" != "0" ] && command -v sudo >/dev/null 2>&1; then sudo="sudo"; fi fmt="appimage" if [ "$(id -u)" = "0" ] || [ -n "$sudo" ]; then if command -v apt-get >/dev/null 2>&1; then fmt="deb" elif command -v dnf >/dev/null 2>&1 || command -v zypper >/dev/null 2>&1 || command -v yum >/dev/null 2>&1; then fmt="rpm" fi fi TMP="$(mktemp -d "${TMPDIR:-/tmp}/p8-install.XXXXXX")" || die "Could not create a temporary folder." url="$(resolve "$fmt$sfx")" || exit 1 case "$url" in *.deb | *.rpm | *.AppImage) ;; *) fmt="appimage"; url="$(resolve "appimage$sfx")" || exit 1 case "$url" in *.AppImage) ;; *) [ -n "$sfx" ] && die "p8 for Linux on arm64 is coming soon. Today it runs on x86_64 Linux. News: $SITE/p8/changelog" die "No p8 build for Linux right now. See $SITE/p8/download" ;; esac ;; esac step "Downloading p8 for Linux ($fmt)" download "$fmt$sfx" "$TMP/p8.$fmt" >/dev/null case "$fmt" in deb) step "Installing with apt (may ask for your password)" $sudo apt-get install -y "$TMP/p8.deb" || die "apt could not install p8." ;; rpm) step "Installing the .rpm (may ask for your password)" if command -v dnf >/dev/null 2>&1; then $sudo dnf install -y "$TMP/p8.rpm" elif command -v zypper >/dev/null 2>&1; then $sudo zypper --non-interactive install --allow-unsigned-rpm "$TMP/p8.rpm" else $sudo yum install -y "$TMP/p8.rpm"; fi || die "Could not install the .rpm." ;; appimage) bin="$HOME/.local/bin"; mkdir -p "$bin" "$HOME/.local/share/applications" install -m 755 "$TMP/p8.appimage" "$bin/p8.AppImage" || die "Could not copy p8 into $bin." printf '[Desktop Entry]\nType=Application\nName=p8\nComment=The workspace for building with AI agents\nExec=%s %%U\nIcon=p8\nCategories=Development;\nMimeType=x-scheme-handler/p8;\nTerminal=false\n' "$bin/p8.AppImage" >"$HOME/.local/share/applications/p8.desktop" command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$HOME/.local/share/applications" >/dev/null 2>&1 || true ;; esac printf '\n %s✓%s %sp8 is installed%s\n' "$G" "$N" "$B" "$N" note "Find it in your app menu. Bought a license? Paste your key in p8." if [ -z "${P8_NO_OPEN:-}" ] && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then exe="$(command -v p8 2>/dev/null || true)" [ -n "$exe" ] || exe="$HOME/.local/bin/p8.AppImage" if [ -x "$exe" ]; then (nohup "$exe" >/dev/null 2>&1 &) && note "Opening p8…"; fi fi printf '\n' } main "$@"