Archive for April, 2023
Running Apache Directory Studio on Apple M1.. cleanly!
Tags: Apache, Apple, Java, LDAP, MacBookThere have been dozens and dozens of posts attempting plenty of weird, unsupportable hacks and workarounds to get ADS working under the ARM cores used by the Apple M1/M2 chipsets. You need a few dependencies installed and configured to get this working, and Rosetta2 does not work in this situation.
Simply installing Apache Directory Studio from their download page or brew, will result in the following error message when you try to launch it:
This is because the version of Java installed via the OS or from Oracle’s own download page, will not work when it’s the native ARM or aarch64 version.
There are many posts that include installing the version of Java from temurin
but that too, will give you the wrong version of the JDK to make this work.
brew install --cask temurin
You need at least Java version 11 in order to run Apache Directory Studio, but version 20 will also work, with the steps here.
Also, editing the path in the Info.plist in /Applications/ApacheDirectoryStudio.app/Contents/Info.plist
to point to the temurin JDK, will also fail.
There’s an XML block at the bottom of the file that implies you can just point to a different java version you have installed and it will use that. It does, but then crashes with the following dialog, even with the temurin version installed:
<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options, or add a VM found via $/usr/libexec/java_home -V
<string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home/bin/java</string>
-->
To see the versions of Java you may have installed, you can run:
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
20 (arm64) "Oracle Corporation" - "Java SE 20" /Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home
20 (x86_64) "Eclipse Adoptium" - "OpenJDK 20" /Library/Java/JavaVirtualMachines/temurin-20.jdk/Contents/Home
17.0.6 (arm64) "Oracle Corporation" - "Java SE 17.0.6" /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home
Ok, enough of the context of the failures… let’s get on to fixing this. You can leave the line you edited into your Contents/Info.plist
and let’s get the right version of the JDK installed. The version we install will just replace the version in that same directory, and you won’t need to change it (unless you get a different version of Java in these steps).
Even the Oracle installer refuses to continue when using the x86_64 version:
Instead of installing temurn using brew reinstall --cask temurin
, you’ll want to visit the Adoptium Temurin download page and grab the version for x86_64, not aarch64, as you normally would get with brew or the Oracle downloads.
Once you download the x86_64 version of Temurin, it will install cleanly.
Now you can run ApacheDirectoryStudio directly from /Applications or your Terminal, and it will work!