Skip to content

Commit

Permalink
Adds a bash script to modify the local Eclipse.app
Browse files Browse the repository at this point in the history
to make it executable on macOS
  • Loading branch information
maxkratz committed Nov 15, 2024
1 parent a009473 commit e407cf2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/how-to-run-eclipse-on-macos.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions scripts/fix-eclipse-app-macos.sh
Original file line number Diff line number Diff line change
@@ -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 <maximilian.kratz@es.tu-darmstadt.de>
# date: 2024-11-15

set -e

FILE="./Eclipse.app/Contents/Info.plist"
JAVA=$(/usr/libexec/java_home)
STRING=" <string>-vm</string><string>$JAVA/bin/java</string>"

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."

0 comments on commit e407cf2

Please sign in to comment.