Fail to run GIMP on macOS via a symlink
Tested with: macOS 10.14.6, GIMP 2.10.12
I can launch GIMP successfully when double-clicking the app bundle.
I can launch GIMP successfully by typing the following in a Terminal:
/Applications/GIMP-2.10.app/Contents/MacOS/gimp
However, if I create the following symlink:
ln -s /Applications/GIMP-2.10.app/Contents/MacOS/gimp /usr/local/bin/
And try to launch GIMP by typing the following in a Terminal:
gimp
I get the following errors:
/gimp: line 43: /usr/local/bin/gimp-bin: No such file or directory
/usr/local/bin/gimp: line 43: exec: /usr/local/bin/gimp-bin: cannot execute: No such file or directory
If I also add gimp-bin
as a symbolic link in /usr/local/bin/
, and try again, I get the following errors:
babl-extension.c:359 void babl_extension_load_dir_list(const char *)()
WARNING: the babl installation seems broken, no extensions found in queried
BABL_PATH (/usr/local/bin/../Resources/lib/babl-0.1) this means no SIMD/instructions/special case fast paths and
only slow reference conversions are available, applications might still
run but software relying on babl for conversions will be slow
Cannot spawn a message bus without a machine-id: Unable to load /var/lib/dbus/machine-id or /etc/machine-id: Failed to open file ?/var/lib/dbus/machine-id?: No such file or directory
babl-format.c:716 const Babl *babl_format(const char *)()
const Babl *babl_format(const char *)("CIE Lab double"): not found
sh: gdb: command not found
Workaround
In the file /Applications/GIMP-2.10.app/Contents/MacOS/gimp
, replace the following line:
BASEDIR=$(cd `dirname $0` && pwd)
by the following to lines:
GIMP_EXECUTABLE=$(readlink "$0")
BASEDIR=$(cd `dirname $GIMP_EXECUTABLE` && pwd)
Notes
On macOS, readlink must not have the -f
option, while on Linus / FreeBSD, it must have it. There seems to be no clean cross-platform way to do this, see https://stackoverflow.com/questions/7665/how-to-resolve-symbolic-links-in-a-shell-script
This issue is related to this other issue, which helped me find the workaround: #3303 (closed)
I have also reported to Homebrew Cask a request to have the symlink automatically created when installing GIMP via brew cask install gimp
: https://github.com/Homebrew/homebrew-cask/issues/69939