Skip to content

Instantly share code, notes, and snippets.

@jb510
Created July 29, 2025 16:05
Show Gist options
  • Select an option

  • Save jb510/89c31a3f892d2415b3824b250e441e99 to your computer and use it in GitHub Desktop.

Select an option

Save jb510/89c31a3f892d2415b3824b250e441e99 to your computer and use it in GitHub Desktop.
update_freecad_weekly.sh
#!/bin/bash
set -e
# After installing chmod +x update_freecad_weekly.sh
# to run ./update_freecad_weekly.sh
# === Configuration ===
PLATFORM="arm64" # Change this to "x86_64" for Intel Macs
APP_NAME="FreeCAD.app"
INSTALL_PATH="/Applications/$APP_NAME"
TMP_DIR="/tmp/freecad_update"
RELEASES_URL="https://api.github.com/repos/FreeCAD/FreeCAD/releases"
mkdir -p "$TMP_DIR"
cd "$TMP_DIR"
echo "πŸ” Fetching latest FreeCAD weekly release info for $PLATFORM..."
DMG_INFO=$(curl -s "$RELEASES_URL" | jq -r --arg platform "$PLATFORM" '
[.[] | select(.tag_name | test("weekly"))][0].assets[]
| select(.name | endswith(".dmg") and contains("macOS") and contains($platform))
| {name: .name, url: .browser_download_url}
')
DMG_NAME=$(echo "$DMG_INFO" | jq -r '.name')
DMG_URL=$(echo "$DMG_INFO" | jq -r '.url')
if [[ -z "$DMG_URL" || "$DMG_URL" == "null" ]]; then
echo "❌ Could not find a macOS .dmg for architecture: $PLATFORM"
exit 1
fi
echo "βœ… Found .dmg: $DMG_NAME"
echo "⬇️ Downloading from: $DMG_URL"
curl -L "$DMG_URL" -o "$DMG_NAME"
echo "πŸ”Œ Mounting .dmg..."
MOUNT_POINT=$(hdiutil attach "$DMG_NAME" | grep "/Volumes" | awk '{print $3}')
echo "πŸ—‘οΈ Removing old FreeCAD (if it exists)..."
if [ -d "$INSTALL_PATH" ]; then
sudo rm -rf "$INSTALL_PATH"
fi
echo "πŸ“¦ Copying new FreeCAD to /Applications..."
cp -R "$MOUNT_POINT/$APP_NAME" /Applications/
echo "⏏️ Ejecting volume..."
hdiutil detach "$MOUNT_POINT"
echo "βœ… FreeCAD Weekly (standalone) has been installed to /Applications."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment