Created
July 29, 2025 16:05
-
-
Save jb510/89c31a3f892d2415b3824b250e441e99 to your computer and use it in GitHub Desktop.
update_freecad_weekly.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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