#!/bin/sh # Lattice Normalize — offline edition installer for macOS. # curl -fsSL https://teamlattice.ai/normalize/install.sh | sh # Downloads one file, checks its SHA-256, installs to ~/.lattice/bin. # Your data never goes anywhere; this script only downloads the program. set -eu BASE="${LATTICE_NORMALIZE_BASE:-https://teamlattice.ai/normalize/dl}" DEST="${LATTICE_NORMALIZE_BIN:-$HOME/.lattice/bin}" case "$(uname -s)" in Darwin) ;; *) echo "This installer is for macOS. On Windows use install.ps1 (see teamlattice.ai/normalize)." >&2; exit 1 ;; esac case "$(uname -m)" in arm64) FILE="lattice-normalize-macos-arm64" ;; x86_64) FILE="lattice-normalize-macos-x64" ;; *) echo "Unsupported Mac CPU: $(uname -m)" >&2; exit 1 ;; esac TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT echo "Downloading $FILE ..." curl -fsSL "$BASE/$FILE" -o "$TMP/$FILE" curl -fsSL "$BASE/SHA256SUMS" -o "$TMP/SHA256SUMS" WANT="$(grep " $FILE\$" "$TMP/SHA256SUMS" | cut -d' ' -f1)" GOT="$(shasum -a 256 "$TMP/$FILE" | cut -d' ' -f1)" if [ -z "$WANT" ] || [ "$WANT" != "$GOT" ]; then echo "Checksum mismatch — not installing." >&2 exit 1 fi mkdir -p "$DEST" mv "$TMP/$FILE" "$DEST/lattice-normalize" chmod 755 "$DEST/lattice-normalize" xattr -d com.apple.quarantine "$DEST/lattice-normalize" 2>/dev/null || true # Apple Silicon only runs signed code; an ad-hoc signature made on this Mac is enough. codesign --force --sign - "$DEST/lattice-normalize" >/dev/null 2>&1 || true case ":$PATH:" in *":$DEST:"*) ;; *) for rc in "$HOME/.zshrc" "$HOME/.bash_profile"; do if [ -f "$rc" ] || [ "$rc" = "$HOME/.zshrc" ]; then grep -qs 'lattice/bin' "$rc" || printf '\nexport PATH="$HOME/.lattice/bin:$PATH"\n' >> "$rc" fi done echo "Added ~/.lattice/bin to your PATH (open a new terminal window to use it)." ;; esac echo "Installed: $DEST/lattice-normalize ($("$DEST/lattice-normalize" version))" echo "" echo "Next:" echo " lattice-normalize setup" echo " lattice-normalize activate " echo " lattice-normalize watch # then drop files in ~/Lattice Normalize/Inbox"