Compiling and Running native Neo4j on Apple M1 ARM64

If one needs to run neo4j natively on the Apple M1 hardware (for example to analyze/query BloodHound ingestor data from an Active Directory) and benefit from the fast CPU it seems to be possible to build and run from source.

I have prepared this “experimental” howto so that others can reproduce this

Pre-Requisites :

  • make or gnu-make
  • wget or curl (to download sources from terminal – otherwise just use your browser)
  • git
  • Xcode full setup (better to have this for development, not entirely sure you need it for neo4j build, but I have it installed since it is a must)

First we need to get a working native version of Java on the M1 ARM64 Apple. This can be achieved by downloading and installing a package from AZUL and selecting the proper options for our platform -> Java 11 (LTS) macOS ARM 64-bit JDK as seen below

Azul Java for MacOS ARM 64-bit

Once installed, verify that we can use Java by running the following in the terminal

Shell java version command

Once Java is installed on the M1 we move on to download Maven from Apache foundation site – available here

Maven Download

I have configured Maven on my Apple M1 ARM64 system as follows

mkdir -p $HOME/SRC/maven
cd $HOME/SRC/maven 
gunzip apache-maven-3.8.1-bin.tar.gz 
tar -xvf apache-maven-3.8.1-bin.tar
rm apache-maven-3.8.1-bin.tar

# Now we need to define this new path to our environment 
# I have added the path to my $PATH as follows (adjust to your needs accordingly) 

export PATH=bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/pkg/sbin:/opt/pkg/bin:/Library/Apple/usr/bin:/Users/user/.cargo/bin:/usr/local/go/bin:/Users/user/go/bin:/Users/user/SRC/maven/apache-maven-3.8.1/bin

Now we should have mvn in our paths so we can move on to build Neo4j

We will now git clone Neo4j source to our SRC directory and set some variables

git clone 
cd neo4j 
ulimit -n 40000 
export MAVEN_OPTS="-Xmx512m" 
mvn clean install

Now after a while the build will fail on the following test

maven build tests fail
Neo4j kernel test fail

Im not really sure why this happens right now and I did not investigate this more right now , but we can build Neo4j without these tests and it will compile and run on the M1

So run the build with these options instead

mvn clean install -DskipTests
Build neo4j success

So now we can test the newly compiled Neo4j instance, but before we do we need to extract the TGZ build

cd $HOME/SRC/neo4j/packaging/standalone/target/
tar -zxvf neo4j-community-4.3.1-SNAPSHOT-unix.tar.gz 

To start the Neo4j DB run the following command (if you built it in $HOME/SRC/neo4j)

/Users/user/SRC/neo4j/packaging/standalone/target/neo4j-community-4.3.1-SNAPSHOT/bin/neo4j console

Following should be visible on your console after it starts

Neo4j running on Apple M1 ARM64

What seems to be broken right now on the M1 is the web console interface to Neo4j – I could not get it to render the web page interface and was left only with a blank window when accessing

I needed to access the console so that I could change the default passwords so instead I tried to connect with the cypher-shell and it allowed me to reset the default credentials and password neo4j (neo4j:neo4j)

cypher-shell connection to Neo4j

So one this was done I wanted to see if I could populate the fresh Neo4j DB with some data – mainly Bloodhound ingestor data from an Active Directory.

BloodHound 4.0.2 can be downloaded from the projects Git and the MacOS x86-64 binary works fine with Rosetta2, however it fails to build for me – I have used pkgsrc/lang/nodejs (version 14.16.0) for this but I could not build yet a native ARM64 BloodHound

cd $HOME/SRC/BLOODHOUND/BloodHound-darwin-x64/

Before BloodHound is fully executed you need to allow the unsigned app in the MacOS security menu to run.

Login with your new neo4j password (user: neo4j)

BloodHound 4.0.2

Now you can try and upload some BloodHound ingestor data from some AD of yours to test the fresh Neo4j on the Apple M1 ARM64 platform – It would be great to benchmark Neo4j on the M1 compared to other architectures (x86_64) but my expertise on that is limited – what I noticed however is the BloodHound ZIP imports to the DB are faster on the M1 than on my Core i5 Panasonic Toughbook C31 with an SSD disk.

BloodHound session

Happy Graphing on the M1!

About astr0baby

Please run Adblock or similar... we have been told to do so since Carl Sagan wrote the Contact .
This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Compiling and Running native Neo4j on Apple M1 ARM64

  1. Ashu says:

    Hi Astr0baby,
    Your Windows local account bypass password Tutorial for win 7,8 are great.

    Is it possible to make a tutorial to bypass Windows 10 live id (online account) with similar method? Which is locally cached.

    • astr0baby says:

      Its more complex with 64bit :)

      • Ashu says:

        Yes, Indeed it’s complex. But it’s possible as Kon-boot does it. But it’s close sourced.

        And live id is getting more common now a days. So, it will be great if method for this can be found out.

        It’s okay, you may have other projects.
        Thanks for the reply.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.