#!/bin/sh # Utah IDE installer for macOS and Linux. # curl -fsSL https://aithatsee.com/utah/ide/install.sh | sh # Installs into your home directory only. Nothing needs sudo. The download is checked against a # SHA-256 pinned in this script before anything is unpacked. set -eu VERSION="0.1.1" URL="https://aithatsee.com/utah/ide/utah-ide-0.1.1.tgz" SHA256="df260e62c9496f23496338ae36bb186ee855e7b33930cf53eb71dc3117b5f266" INSTALL_ROOT="${UTAH_IDE_INSTALL_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/utah-ide}" BIN_DIR="${UTAH_IDE_BIN_DIR:-$HOME/.local/bin}" say() { printf '%s\n' "$*"; } fail() { printf 'Utah IDE install failed: %s\n' "$*" >&2; exit 1; } command -v node >/dev/null 2>&1 || fail "Node.js 22.13 or newer is required and was not found. Install it from https://nodejs.org and run this again." NODE_OK=$(node -e 'const [a,b]=process.versions.node.split(".").map(Number); process.stdout.write(a>22||(a===22&&b>=13)?"yes":"no")') [ "$NODE_OK" = "yes" ] || fail "Node.js 22.13 or newer is required; found $(node --version). Update Node.js and run this again." command -v tar >/dev/null 2>&1 || fail "tar is required." TMP=$(mktemp -d 2>/dev/null || mktemp -d -t utah-ide) trap 'rm -rf "$TMP"' EXIT INT TERM ARCHIVE="$TMP/package.tgz" say "Downloading Utah IDE $VERSION…" if command -v curl >/dev/null 2>&1; then curl -fsSL "$URL" -o "$ARCHIVE" || fail "download failed: $URL" elif command -v wget >/dev/null 2>&1; then wget -q "$URL" -O "$ARCHIVE" || fail "download failed: $URL" else fail "curl or wget is required." fi if command -v shasum >/dev/null 2>&1; then GOT=$(shasum -a 256 "$ARCHIVE" | awk '{print $1}') elif command -v sha256sum >/dev/null 2>&1; then GOT=$(sha256sum "$ARCHIVE" | awk '{print $1}') else GOT=$(node -e 'const c=require("crypto"),f=require("fs");process.stdout.write(c.createHash("sha256").update(f.readFileSync(process.argv[1])).digest("hex"))' "$ARCHIVE") fi [ "$GOT" = "$SHA256" ] || fail "checksum mismatch (expected $SHA256, got $GOT). Nothing was installed." TARGET="$INSTALL_ROOT/$VERSION" STAGE="$INSTALL_ROOT/.staging-$$" rm -rf "$STAGE" mkdir -p "$STAGE" "$BIN_DIR" tar -xzf "$ARCHIVE" -C "$STAGE" --strip-components 1 || fail "could not unpack the download." [ -f "$STAGE/bin/utah-ide.mjs" ] || fail "the download is not an Utah IDE package." rm -rf "$TARGET" mv "$STAGE" "$TARGET" LAUNCHER="$BIN_DIR/utah-ide" cat > "$LAUNCHER.tmp" </dev/null || true) [ "$INSTALLED" = "$VERSION" ] || fail "the installed copy did not start (got '$INSTALLED')." # Remove older versions; the one just installed stays. for old in "$INSTALL_ROOT"/*; do [ -d "$old" ] || continue [ "$old" = "$TARGET" ] || rm -rf "$old" done say "Utah IDE $VERSION is installed: $LAUNCHER" case ":$PATH:" in *":$BIN_DIR:"*) ;; *) say ""; say "Add it to your PATH (then open a new terminal):"; say " echo 'export PATH=\"$BIN_DIR:\$PATH\"' >> ~/.zshrc # or ~/.bashrc" ;; esac say "" say "Next:" say " utah-ide login sign in" say " utah-ide doctor check this machine" say " utah-ide start in the current project"