Running ArchivesSpace on an M1 Mac
A few of us over at Hudson Molonglo have recently been trying out Apple's latest M1 offerings—a new family of CPUs based on the ARM architecture.
At the time of writing (early 2022), there are a few hurdles to getting an ArchivesSpace development environment running, but it can be done. Let's dive in.
Getting Java 8
ArchivesSpace still recommends Java 8, and that's our first hurdle: Oracle doesn't provide ARM64 builds of older versions of Java. Fortunately, the good people at Azul do. If you head over to Azul's download page, you'll find you can download a version of Java as follows:
Java Version: JDK 8 (LTS)
Operating System: macOS
Architecture: ARM 64-bit
Java Package: JDK
Grab whichever package format takes your fancy, download it and unpack it somewhere. I unpacked mine to:
Setting up ArchivesSpace with a working JRuby version
As of early 2022, ArchivesSpace targets the 9.2 series of JRuby, which is compatible with MRI Ruby 2.5. The latest release (188.8.131.52) is missing some patches that are necessary for running ArchivesSpace on the M1.
We're going to pull in a custom version of JRuby. If you'd like to build it yourself, we have placed a branch here:
You can build it by running Maven from a checked out copy:
./mvnw clean && ./mvnw -Pcomplete
Alternatively, you can grab the copy I built and just use that:
Once you have a
jruby-complete JAR file, copy it somewhere on your
system where you won't lose it. Your
wouldn't be a bad choice.
Now, you can get ArchivesSpace using it. Open the
file and set your
jruby_file properties as follows
(replacing the two lines that are already there, and substituting the
right path to your JRuby file):
<property name="jruby_url" value="file:///Users/mst/archivesspace/jruby-complete-184.108.40.206-SNAPSHOT.jar" /> <property name="jruby_file" value="jruby-complete-220.127.116.11-SNAPSHOT.jar" />
That's it for JRuby.
A small ArchivesSpace code change
There is one small code change required to make ArchivesSpace compatible with the latest version of JRuby. Edit the file:
define_method(:values) do values = super
define_method(:values) do values = super()
That is, add the empty set of parens to the
super call. If you
don't do that, you'll see this error and wonder why:
[java] RuntimeError: implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly. [java] uses_enums at /Users/mst/test/archivesspace/backend/app/model/mixins/dynamic_enums.rb:61
We'll be sending a pull request to fix this in future ArchivesSpace versions.
Putting it all together
With all of that, you have Java 8, JRuby 9.2 and a (lightly modified) ArchivesSpace instance. The final steps are:
Make sure your Java 8 install is on your $PATH:
Confirm you're getting the right version:
% java -version openjdk version "1.8.0_302" OpenJDK Runtime Environment (Zulu 18.104.22.168-CA-macos-aarch64) (build 1.8.0_302-b08) OpenJDK 64-Bit Server VM (Zulu 22.214.171.124-CA-macos-aarch64) (build 25.302-b08, mixed mode)
Bootstrap your ArchivesSpace install to grab all dependencies:
Run the various dev servers:
build/run backend:devserver build/run frontend:devserver build/run indexer