How to install Neo4j on OSX Maverics

1,830 views
Skip to first unread message

Fisnik Shpuza

unread,
Oct 31, 2013, 11:58:26 AM10/31/13
to ne...@googlegroups.com
I had a lot of problems installing neo4j-community-2.0.0-M06 on my Mac running Mavericks. 

I am sharing here the steps I followed to fix some issues along the way.

  1. install java 7 from oracle http://www.java.com/en/download/faq/java_mac.xml
  2. create symbolic link to this path. This is required as the Neo4j start script will not like the spaces in the path of the java home. 
    • ln -s /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/ JavaHome
  3. Update the bash profile on Maverics (new location for this one) 
    • sudo vim ~/.bash_profile
    • export JAVA_HOME="<your path to the new symbolic link>/JavaHome"
  4. Download neo4j-community-2.0.0-M06 and copy it to your favorite path mine is "/usr/local/opt/neo2.0"
  5. Run the "/usr/local/opt/neo2.0/bin/neo4j start" command
Done. 

Michael Hunger

unread,
Oct 31, 2013, 12:24:13 PM10/31/13
to ne...@googlegroups.com
Actually it should be enough to use:

export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
bin/neo4j start

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Wes Freeman

unread,
Oct 31, 2013, 1:00:45 PM10/31/13
to ne...@googlegroups.com
It seems as though if you upgrade to Mavericks AND already have Java 7 installed, Neo4j works out of the box.

We had trouble in the tutorial where the java_home trick didn't work on Tuesday. It wasn't showing the 1.7 install even after successfully installing. I'm not sure what the problem was--we didn't resolve it.

Thanks for posting Fisnik.

Wes

Fisnik Shpuza

unread,
Oct 31, 2013, 8:13:02 PM10/31/13
to ne...@googlegroups.com

You are right Wes...thos happened on a frsh install. The problem is at the "space" found in the java home path on v 7 that tje neo script complained about..

You received this message because you are subscribed to a topic in the Google Groups "Neo4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4j/CwYKne8A9kk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to neo4j+un...@googlegroups.com.

Mark Needham

unread,
Nov 1, 2013, 6:56:27 AM11/1/13
to ne...@googlegroups.com
Hi Fisnik,

Could you quickly run this command from your terminal and paste the results?

/usr/libexec/java_home -V

e.g. for me

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
1.7.0_21, x86_64: "Java SE 7"
/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home
1.6.0_45-b06-451, x86_64: "Java SE 6"
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_45-b06-451, i386: "Java SE 6"
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home

I'm wondering whether JRE installations don't get shown on this
list...because AFAIK by default on a Mac you have the 1.6 JDK whereas
the default Java installation for 1.7 is to use JRE.

If that's the case we need to figure out how to tell Neo4j where the
JRE is installed.

Mark

Mark Needham

unread,
Nov 1, 2013, 1:45:54 PM11/1/13
to ne...@googlegroups.com
Hi Fisnik,

I've spiked out a potential fix which I think does the job but it'd be cool if you could give it a try:

If you grab this file:


And replace bin/utils

And this file:


And replace bin/neo4j

And see if you can start Neo4j without the need to set JAVA_HOME. 

I've tried it out on my machine with the latest 1.7 JRE but it'd be cool to know if it works for you as well.

Mark

Fisnik Shpuza

unread,
Nov 2, 2013, 1:40:27 AM11/2/13
to ne...@googlegroups.com
Hi Mark, 

Here is the steps I took to test it out.

  1. Stopped Neo4j 
  2. Removed Java_Path from my bash_profile. 
  3. Started a new terminal.
  4. Applied your changes
  5. Started Neo4j.
    1. This command worked. 
  6. Black Box Test  - Create Command - CREATE (n:Person { name : 'Andres', title : 'Developer' });
    1. This command failed
NOTE: I tried these steps on twice to make sure I did not mess up (in two different NEO4j 2.0 directories. The version of the kernel after I applied the changes is showing Kernel version Neo4j - Graph Database Kernel 1.9.2.
Screenshots attached


Fisnik

Mark Needham

unread,
Nov 2, 2013, 2:01:26 AM11/2/13
to ne...@googlegroups.com
Hey,

That's very weird!

These are the two commits showing the changes I made to the files:


If you want to just test out setting JAVA_HOME to a path which contains spaces that's what this version of 'bin/neo4j' should do. 'bin/utils' was for detecting the JRE location automatically.

So I have no idea why it'd be showing a 1.9.2 version because the changes are relatively minor. 

Is there a rogue 1.9.2 running somehow? 

Try:

lsof -i :7474

Grab the pid and then check what you get back from 'ps aux | grep <pid>'

That error message is indicating that you cant create a node with a label which is true in 1.9.* but not in 2.0. 

Mark

Eric Fennell

unread,
Nov 2, 2013, 7:41:27 PM11/2/13
to ne...@googlegroups.com
Hey Mark, 

I had some troubling getting Neo4j up and running on a fresh OS X 10.9 install.   After it complained about the 1.6 jvm, I went and downloaded and installed the 1.7 jre, and even manually updating my path as Fisnik described didn't really seem to help.   I still got some warning about  missing flags, and  Neo4j failed to start.   

That's when I noticed in the oracle docs that:
"Installing a JRE from Oracle will not update java -version symlinks or add java to your path. To be able to do this, you need to install the JDK."
(http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jre.html)

and then was able to start Neo4j without any issues.  Just kinda worked. 

Still pretty new to all this, but hope it helps some. 

Thanks,
Eric  

Fisnik Shpuza

unread,
Nov 3, 2013, 12:24:40 AM11/3/13
to ne...@googlegroups.com
I had a phantom 1.9 running on the bg. If Mark changes make it to the next release - consider my workaround irrelevant. Nice work Mark <
Here is the spill from the start command .

fisniks-air:neo2.0 auser$ bin/neo4j start

Unable to find any JVMs matching version "1.7".

WARNING! You are using an unsupported Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7.

Using additional JVM arguments:  -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled

Starting Neo4j Server...WARNING: not changing user

process [639]... waiting for server to be ready...... OK.

http://localhost:7474/ is ready.

fisniks-air:neo2.0 auser$




Mark Needham

unread,
Nov 3, 2013, 3:12:55 AM11/3/13
to ne...@googlegroups.com
Hi Eric,

Could you attach your data/log/console.log file from when it failed to start to see if there's anything in there that explains what happened.

And yeh the current start scripts work fine if you have the JDK installed but have problems with the JRE because it doesn't get picked up as you've noticed!

Mark

Eric Brooke

unread,
Feb 7, 2014, 4:18:00 PM2/7/14
to ne...@googlegroups.com
thanks Mark this for me to the next step :-)
Reply all
Reply to author
Forward
0 new messages