#!/bin/bash # ClipForge Helper installer for macOS. # Run in Terminal: # curl -fsSL https://clips.thegridreport.news/helper/install-mac.sh | bash # Installs (free, open source) into ~/ClipForgeHelper: # yt-dlp (github.com/yt-dlp/yt-dlp) - downloads the video # ffmpeg (ffmpeg.martin-riedl.de builds) - joins video + audio # deno (github.com/denoland/deno) - JS runtime yt-dlp needs for YouTube # and puts "ClipForge Helper.command" on your Desktop. set -e SERVER="${CLIPFORGE_SERVER:-https://clips.thegridreport.news}" DIR="${CLIPFORGE_HOME:-$HOME/ClipForgeHelper}" BIN="$DIR/bin" DESKTOP="${CLIPFORGE_DESKTOP:-$HOME/Desktop}" mkdir -p "$BIN" "$DIR/downloads" cd "$DIR" OS="$(uname -s)"; ARCH="$(uname -m)" echo "⚡ Installing ClipForge Helper into $DIR ($OS $ARCH)" fetch() { # url dest curl -fL --retry 3 --progress-bar -o "$2" "$1" } if [ "$OS" = "Darwin" ]; then echo "• yt-dlp" fetch https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_macos "$BIN/yt-dlp" if [ "$ARCH" = "arm64" ]; then FA=arm64; DA=aarch64; else FA=amd64; DA=x86_64; fi for t in ffmpeg ffprobe; do echo "• $t" fetch "https://ffmpeg.martin-riedl.de/redirect/latest/macos/$FA/release/$t.zip" "$DIR/$t.zip" unzip -o -q "$DIR/$t.zip" -d "$BIN" && rm -f "$DIR/$t.zip" done echo "• deno" fetch "https://github.com/denoland/deno/releases/latest/download/deno-$DA-apple-darwin.zip" "$DIR/deno.zip" unzip -o -q "$DIR/deno.zip" -d "$BIN" && rm -f "$DIR/deno.zip" else # Linux (used for testing; works on x86_64 desktops too) echo "• yt-dlp" fetch https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux "$BIN/yt-dlp" command -v ffmpeg >/dev/null || echo " (install ffmpeg with your package manager)" if ! command -v deno >/dev/null; then echo "• deno" fetch https://github.com/denoland/deno/releases/latest/download/deno-x86_64-unknown-linux-gnu.zip "$DIR/deno.zip" unzip -o -q "$DIR/deno.zip" -d "$BIN" && rm -f "$DIR/deno.zip" fi fi echo "• ClipForge Helper script" fetch "$SERVER/helper/clipforge-helper.sh" "$DIR/clipforge-helper.sh" chmod +x "$BIN"/* "$DIR/clipforge-helper.sh" # files fetched with curl aren't quarantined, but clear the flag just in case command -v xattr >/dev/null && xattr -dr com.apple.quarantine "$DIR" 2>/dev/null || true # the Desktop launcher (double-click it) mkdir -p "$DESKTOP" LAUNCH="$DESKTOP/ClipForge Helper.command" cat > "$LAUNCH" </dev/null 2>&1 && echo " yt-dlp OK ($("$BIN/yt-dlp" --version))" || { echo " yt-dlp FAILED"; FAIL=1; } FF="$BIN/ffmpeg"; [ -x "$FF" ] || FF="$(command -v ffmpeg)" "$FF" -version >/dev/null 2>&1 && echo " ffmpeg OK" || { echo " ffmpeg FAILED"; FAIL=1; } DN="$BIN/deno"; [ -x "$DN" ] || DN="$(command -v deno)" "$DN" --version >/dev/null 2>&1 && echo " deno OK" || echo " deno not working (YouTube may offer fewer formats; usually still fine)" echo "" if [ -n "$FAIL" ]; then echo "⚠️ Something didn't install right. Take a screenshot of this window and send it to whoever set this up." else echo "✅ Done! On your Desktop you now have: ClipForge Helper.command" echo " Copy a YouTube link, double-click it, press Enter. That's it." fi