#!/usr/bin/env bash # Voiceinator installer. Read it, then run it: # curl -fsSL https://voiceinator.com/install.sh | bash # Free, Apple Silicon only, macOS 14+. Installs to /Applications. set -euo pipefail # The publish step updates these two lines. VERSION="1.2.2" SHA256="3950bb1643f6a4ff8791ecba4224bfabf6f4007f131fd03a008a2173ab9898e9" URL="${VOICEINATOR_DMG_URL:-https://updates.boringlabs.online/Voiceinator-$VERSION.dmg}" INSTALL_DIR="${INSTALL_DIR:-/Applications}" die() { printf "\nVoiceinator: %s\n" "$*" >&2; exit 1; } [ "$(uname -s)" = "Darwin" ] || die "Voiceinator only runs on a Mac." [ "$(uname -m)" = "arm64" ] || die "This Mac has an Intel chip. Voiceinator needs an Apple chip, M1 or newer." [ "$(sw_vers -productVersion | cut -d. -f1)" -ge 14 ] || die "Voiceinator needs macOS 14 or newer. Update your Mac first: Apple menu, System Settings, General, Software Update." [ -w "$INSTALL_DIR" ] || die "Your account can't add apps to $INSTALL_DIR. Ask the person who set up this Mac to run this for you." # The DMG is ~4.4 GB and the app is ~4.9 GB, and both exist at once. NEED_GB="${VOICEINATOR_NEED_GB:-10}" free_gb=$(( $(df -k "$INSTALL_DIR" | awk 'NR==2 {print $4}') / 1048576 )) [ "$free_gb" -ge "$NEED_GB" ] || die "You need about $NEED_GB GB free. You have $free_gb GB. Free up some space, then run this again." TMP="$(mktemp -d)" MNT="$TMP/mnt" cleanup() { hdiutil detach "$MNT" -quiet 2>/dev/null || true rm -rf "$TMP" } trap cleanup EXIT echo "Step 1 of 3: Downloading Voiceinator $VERSION. It's big (about 4.4 GB), so this can take a few minutes." curl -fL --progress-bar "$URL" -o "$TMP/Voiceinator.dmg" echo "Step 2 of 3: Checking the download." actual="$(shasum -a 256 "$TMP/Voiceinator.dmg" | cut -d' ' -f1)" [ "$actual" = "$SHA256" ] || die "The download came out wrong, so I stopped. Nothing was installed. Run this again. (Expected $SHA256, got $actual.)" echo "Step 3 of 3: Putting Voiceinator in $INSTALL_DIR." mkdir -p "$MNT" hdiutil attach -nobrowse -readonly -quiet -mountpoint "$MNT" "$TMP/Voiceinator.dmg" [ -d "$MNT/Voiceinator.app" ] || die "The download is missing the app, so I stopped. Nothing was installed. Run this again." if pgrep -x Voiceinator >/dev/null 2>&1; then osascript -e 'tell application "Voiceinator" to quit' >/dev/null 2>&1 || true sleep 2 fi rm -rf "$INSTALL_DIR/Voiceinator.app" ditto "$MNT/Voiceinator.app" "$INSTALL_DIR/Voiceinator.app" xattr -cr "$INSTALL_DIR/Voiceinator.app" echo "" # Only open it for a real install, not a test dir. if [ "$INSTALL_DIR" = "/Applications" ]; then echo "Done! Voiceinator is in Applications, and it's opening now." echo "A setup window shows up. Follow it one step at a time." echo "You can close this Terminal window." open "$INSTALL_DIR/Voiceinator.app" else echo "Done! Voiceinator is in $INSTALL_DIR." fi