-
-
Save crazym8nd/18f1ffc815f4ef713c240bc13e5a392d to your computer and use it in GitHub Desktop.
Resets the CrossOver Trial. This script is only intended for educational purposes. This script is ONLY for macOS. THIS SCRIPT IS NOT FOR PIRACY.
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
| #!/usr/bin/env zsh | |
| printf "PT09IENyb3NzT3ZlciBUcmlhbCBSZXNldCBTY3JpcHQgPT09DQpbSU5GT10gVGhpcyBzY3JpcHQgaXMgb25seSBtZWFudCBmb3IgZWR1Y2F0aW9uYWwgcHVycG9zZXMuDQpbV0FSTklOR10gSWYgeW91IGRpZG4ndCBnZXQgdGhpcyBzY3JpcHQgZnJvbSBueGZ4MjEncyBHaXRIdWIgR2lzdCwgaXQgbWF5IGhhdmUgYmVlbiB0YW1wZXJlZCB3aXRoLiBJZiB5b3UgZGlkIGdldCB0aGlzIG9mZiBueGZ4MjEncyBHaXRIdWIgR2lzdCwgeW91IGFyZSBzYWZlLCBjYXJyeSBvbi4gQmUgY2F1dGlvdXMgd2hlbiBydW5uaW5nIG9ubGluZSBjb2RlLCBhbmQgYWx3YXlzIGNoZWNrIGlmIGl0IGRvZXMgYW55dGhpbmcgdGhhdCB5b3UgZG9uJ3QgbGlrZS4=" | base64 -D | |
| echo "\n[LOG] Started at: $(date)" | |
| # Check if Homebrew exists, install if needed | |
| if ! command -v brew >/dev/null 2>&1; then | |
| echo "[INFO] Homebrew not found. Installing Homebrew..." | |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| if command -v brew >/dev/null 2>&1; then | |
| echo "[SUCCESS] Homebrew installed successfully." | |
| else | |
| echo "[ERROR] Failed to install Homebrew. Exiting." | |
| exit 1 | |
| fi | |
| fi | |
| # Check if pidof exists, install if needed | |
| if ! command -v pidof >/dev/null 2>&1; then | |
| echo "[INFO] 'pidof' not found. Installing via Homebrew..." | |
| brew install pidof || { echo "[ERROR] Failed to install pidof. Exiting."; exit 1; } | |
| fi | |
| # Locate CrossOver binary | |
| CO_PWD=~/Applications/CrossOver.app/Contents/MacOS | |
| [ -d "${CO_PWD}" ] || CO_PWD=/Applications/CrossOver.app/Contents/MacOS | |
| [ -d "${CO_PWD}" ] || { echo "[ERROR] Could not locate CrossOver binary. Exiting."; exit 1; } | |
| echo "[INFO] CrossOver path: ${CO_PWD}" | |
| # Kill all CrossOver processes | |
| echo "[INFO] Killing running CrossOver processes..." | |
| pkill -9 CrossOver 2>/dev/null || echo "[INFO] No running CrossOver processes found." | |
| sleep 2 | |
| # Set new RFC3339 UTC datetime (3 hours back) | |
| DATETIME=$(date -u -v -3H '+%Y-%m-%dT%TZ') | |
| PLIST=~/Library/Preferences/com.codeweavers.CrossOver.plist | |
| if [ -f "${PLIST}" ]; then | |
| echo "[INFO] Updating trial start date in preferences..." | |
| plutil -replace FirstRunDate -date "${DATETIME}" "${PLIST}" | |
| plutil -replace SULastCheckTime -date "${DATETIME}" "${PLIST}" | |
| else | |
| echo "[WARNING] CrossOver plist not found. Skipping plist update." | |
| fi | |
| # Clean bottle system.reg entries | |
| BOTTLE_DIR=~/Library/Application\ Support/CrossOver/Bottles | |
| echo "[INFO] Cleaning system.reg entries from bottles..." | |
| for file in "${BOTTLE_DIR}"/*/system.reg; do | |
| [ -f "${file}" ] || continue | |
| sed -i '' -e "/^\[Software\\\\\\\\CodeWeavers\\\\\\\\CrossOver\\\\\\\\cxoffice\]/,+6d" "${file}" | |
| echo " → Cleaned ${file}" | |
| done | |
| # Remove update timestamp files | |
| echo "[INFO] Removing .update-timestamp files..." | |
| for update_file in "${BOTTLE_DIR}"/*/.update-timestamp; do | |
| [ -f "${update_file}" ] && rm -f "${update_file}" && echo " → Deleted ${update_file}" | |
| done | |
| # Show macOS notifications | |
| /usr/bin/osascript -e "display notification \"Trial date reset to ${DATETIME}\" with title \"CrossOver Trial Reset\"" | |
| /usr/bin/osascript -e "display notification \"Bottle timestamps removed\" with title \"CrossOver Trial Reset\"" | |
| # Start original CrossOver binary | |
| ORIGINAL="${CO_PWD}/CrossOver" | |
| [ -x "${ORIGINAL}" ] && { | |
| echo "[INFO] Launching CrossOver..." | |
| open -a "${ORIGINAL}" | |
| } || { | |
| echo "[ERROR] Could not find executable: ${ORIGINAL}" | |
| exit 1 | |
| } | |
| echo | |
| echo "=== Done ===" | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
BOTTLE_DIR - I had a bottle on an external SSD, so I changed it to the proper location and one I didn't need " * " in the path, so i changed "${BOTTLE_DIR}"/*/system.reg; to "${BOTTLE_DIR}"/system.reg; and for update-timestamp.