From e407cf2fedc29bcf6df14616c2417d7887c0cfc4 Mon Sep 17 00:00:00 2001 From: Max Kratz Date: Fri, 15 Nov 2024 21:44:39 +0100 Subject: [PATCH] Adds a bash script to modify the local Eclipse.app to make it executable on macOS --- doc/how-to-run-eclipse-on-macos.md | 4 +++- scripts/fix-eclipse-app-macos.sh | 31 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 scripts/fix-eclipse-app-macos.sh diff --git a/doc/how-to-run-eclipse-on-macos.md b/doc/how-to-run-eclipse-on-macos.md index 31d604f..e3bd875 100644 --- a/doc/how-to-run-eclipse-on-macos.md +++ b/doc/how-to-run-eclipse-on-macos.md @@ -1,6 +1,6 @@ # How to run a custom Eclipse on macOS -(Apparantly, this was only tested on AMD64-based Macs = Intel Macs only!) +(Apparantly, this was successfully tested on AMD64-based and ARM64-based Macs.) ## Problem @@ -41,6 +41,8 @@ The following steps are necessary to run a custom Eclipse on modern macOS system You can now start your custom `Eclipse.app` with a double click on it. If macOS asks if you really want to start the "broken" app, select `Run`. +All modifications on the local `Eclipse.app` can also be made with [this script](../scripts/fix-eclipse-app-macos.sh). + --- ## Currently known issues diff --git a/scripts/fix-eclipse-app-macos.sh b/scripts/fix-eclipse-app-macos.sh new file mode 100755 index 0000000..11c126b --- /dev/null +++ b/scripts/fix-eclipse-app-macos.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# This script patches the `Info.plist` file in the Eclipse.app to +# properly make/mark it executable. +# +# author: Max Kratz +# date: 2024-11-15 + +set -e + +FILE="./Eclipse.app/Contents/Info.plist" +JAVA=$(/usr/libexec/java_home) +STRING=" -vm$JAVA/bin/java" + +if [ ! -f $FILE ]; then + echo "=> Eclipse.app not found in local folder." + exit 1; +fi + +if grep -Fq "$STRING" $FILE > /dev/null +then + echo "=> Info.plist already patched." +else + echo "=> Patching Info.plist." + sed -i -e '/.eclipse_keyring/a\'$'\n'"$STRING" $FILE +fi + +sudo codesign --force --deep --sign - ./Eclipse.app +xattr -d com.apple.quarantine ./Eclipse.app || true + +echo "=> Done."