#!/bin/bash # ChindaBot on a Mac with Apple silicon, in one line (docs/shell/lite.md): # curl -fsSL https://huggingface.co/iapp/chindabot/resolve/main/install.sh | bash # It downloads ChindaBot.app, puts it in Applications (the person's own if the machine's cannot be written), # and opens it. A program this script downloads is not quarantined by macOS, so it opens with no warning; the # .dmg beside it is the same program, opened the first time from System Settings > Privacy & Security. set -euo pipefail url=${CHINDABOT_URL:-https://huggingface.co/iapp/chindabot/resolve/main/ChindaBot-mac-arm64.zip} [ "$(uname -s)" = Darwin ] || { echo "This installer is for macOS. See https://huggingface.co/iapp/chindabot" >&2; exit 1; } [ "$(uname -m)" = arm64 ] || { echo "ChindaBot needs a Mac with Apple silicon (M1 or later)." >&2; exit 1; } tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT echo "Downloading ChindaBot…" curl -fL --progress-bar -o "$tmp/ChindaBot.zip" "$url" ditto -x -k "$tmp/ChindaBot.zip" "$tmp/app" [ -d "$tmp/app/ChindaBot.app" ] || { echo "The download holds no ChindaBot.app." >&2; exit 1; } codesign --verify --deep --strict "$tmp/app/ChindaBot.app" dest=${CHINDABOT_DEST:-/Applications}; [ -w "$dest" ] || { dest=$HOME/Applications; mkdir -p "$dest"; } rm -rf "$dest/ChindaBot.app" && ditto "$tmp/app/ChindaBot.app" "$dest/ChindaBot.app" xattr -dr com.apple.quarantine "$dest/ChindaBot.app" 2>/dev/null || true echo "ChindaBot is in $dest. Opening it…" [ -n "${CHINDABOT_NO_OPEN:-}" ] || open "$dest/ChindaBot.app"