Running Gephi 0.8.2-beta on MacOS X 10.8.5 Mountain Lion

For my research I’m recently doing a lot of graph and network analysis. So far the tools in ESRI ArcGIS have been sufficient for what I was trying to achieve. I used their Network Analyst Extension and also the Urban Network Analysis toolbox by the City Form Lab at the MIT/SUTD for a more scientific application: the calculation of centrality measures. While these warrant some more in-depth articles in themselves, here I’d like to put a more technical focus on a really annoying problem when using Gephi on a more recent MacOS X system.

Gephi is an open source graph visualization and analysis software. They themselves describe it as follows:

Gephi is a tool for people that have to explore and understand graphs. Like Photoshop but for data, the user interacts with the representation, manipulate the structures, shapes and colors to reveal hidden properties. The goal is to help data analysts to make hypothesis, intuitively discover patterns, isolate structure singularities or faults during data sourcing. It is a complementary tool to traditional statistics, as visual thinking with interactive interfaces is now recognized to facilitate reasoning. This is a software for Exploratory Data Analysis, a paradigm appeared in the Visual Analytics field of research.

(Gephi website)

It’s a Java-based application and hence available for a number of platforms, including Windows, MacOS and Linux. Now, this should make MacOS X users already listen up, since the story of Java on MacOS X has not been an easy one over the past few months year or so. Basically Apple deemed the official (i.e. Oracle) releases of Java 6 insecure and therefore started to publish their own. With the release of Java 7 Oracle stopped publishing Java 6 for the MacOS X platform completely. This sounds like a good thing, and it definitely is in terms of security. Nowadays MacOS X has complete control over the Java installed and running on more recent MacOS X systems. I think this is true for everything from 10.6 Snow Leopard, but may be wrong here, but definitely from 10.7 Lion and upwards (10.8 Mountain Lion and also 10.9 Mavericks).

The problems start when you try to run a Java-based application that requires Java 6 on one of these machines. Basically using such software doesn’t sound like a good idea, but in the case of Gephi there’s no way around it: it’s developed by a non-profit organization (the Gephi Consortium) and therefore doesn’t really have the means (in monetary terms) or the manpower to keep up with this kind of fast-moving developments. I don’t blame them! The interesting thing is that this poses quite a problem, since Gephi in its latest release 0.8.2 is not able to run on those MacOS X systems with Java 7 installed. (Interesting side note: when I tried to install the very same Gephi 0.8.2-beta release on my Windows 7 virtual machine it ran perfectly fine with the Java 7 installed there…) Since I’m working with quite extensive network graphs in my research I really wanted to have Gephi run natively (well, kind of, since it’s still Java…) on my Mac for memory reasons. So I scoured the web and numerous web forums for a solution to this problem. Two things quickly became obviuos: 1) I’m not the only one with this problem, and 2) the solution is actually quite simple but I only found it hidden deeply in a thread on the Gephi GitHub page. So to make things easier for fellow sufferers I decided to quickly put together a write-up of my experience. Spoiler alert: I solved the issue in the end!

I started unprejudiced with downloading said gephi-0.8.2-beta release for MacOS X from the official Gephi website: https://gephi.org/users/download/
It’s a 42 MB .dmg file that contains the Gephi application. The installation is therefore simple: just drag the .app file into the Applications folder on your Mac and you’re done. Or so I thought.

When I first fired up Gephi everything seemed to be fine. After a splash screen the main program window opened:

Gephi 0.8.2-beta first start-up on MacOS X 10.8.5

Gephi 0.8.2-beta first start-up on MacOS X 10.8.5

I selected the Les Miserables.gexf file to open, and confirmed the Import Report, after setting the graph type to “directed” (I found this information in the Gephi Quick Start Tutorial):

Gephi 0.8.2 Import Report

Gephi 0.8.2 Import Report

This was the result:

Gephi 0.8.2-beta empty Graph window on MacOS X 10.8.5

Gephi 0.8.2-beta empty Graph window on MacOS X 10.8.5

The graph window in the center of the application stayed empty. In addition, what you can’t see from the screenshot, I also got the blue beachball when my mouse crossed the (empty) graph window and the application was generally unresponsive. It even refused to shutdown when quit by ⌘Q. This last fact and some early search results directed me into the right direction: we’re dealing with a Java-related issue.

Basically, what most forum posts recommended was to install an old Java 6 JDK and be done. Yet, that’s easier said than done. As I mentioned above, Oracle stopped providing Java 6 for MacOS on their download page. Most commenters therefore pointed at the old Apple Software Updates for Java 6. It took me quite a while to find one that solved my problem by actually installing a Java 6 JDK onto my system. As recommended on some sites I tried the Java for OS X 2012-005 update, but to no avail. After an afternoon of cursing and digging deeper into the topic I finally found what I was looking for on the Apple Developer Platform: the Java for OS X 2012-006 Developer Package:

Java 6 Download from Apple

Java 6 Download from Apple


Please note that in order to access the Apple Developer Platform you need to login using just a valid Apple ID – no developer account necessary!

This will download a 158.1 MB image file called javadeveloper_for_os_x_2012006__11m3909.dmg onto your system which in turn contains a software package called JavaDeveloper.pkg. After installing this, I finally found a Java 6 JDK on my system!

You can check the installed Java Virtual Machines by looking into the folder /Library/Java/JavaVirtualMachines. Before this installation all that was in there was the most recent Java 7 JDK in a folder jdk1.7.0_45.jdk. (Yes, it’s a folder, even though it’s ending in what seems like a file extension .jdk) Now I was happy to see a new 1.6.0_37-b06-434.jdk in there, too!

$ ls -la
total 0
drwxr-xr-x  5 root  wheel  170 12  6 17:34 .
drwxrwxr-x  5 root  admin  170 12  6 17:34 ..
drwxr-xr-x  3 root  wheel  102 10  5  2012 1.6.0_37-b06-434.jdk
drwxr-xr-x  3 root  wheel  102 12  6 17:08 jdk1.7.0_45.jdk

Stay with me, we’re almost there!

All that’s left to do now is to tell Gephi to actually use this Java 6 JDK. While in a terminal window you can (and should!) make sure that your system still regards Java 7 as the currently active JDK by running the following command:

$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

So here everything is alright, MacOS X ignores the newly installed Java 6 JDK and continues to go to Java 7 (1.7.0_45) for all its Java needs. Instead, Gephi needs a pointer as to where it can find Java 6. This can be done by editing the file gephi.conf. It’s living inside the Gephi application package and can be accessed in one of two ways:

MacOS X Finder: Open Package Contents

MacOS X Finder: Open Package Contents

After right-clicking the Gephi application in your Applications folder in a Finder window, select the option “Show Package Contents”. Then navigate to the subfolder Contents > Resources > gephi > etc. Alternatively you can use the Finder tool “Go To Folder…” from the “Go” menu (or press ⌘⇧G) and enter /Applications/Gephi.app/Contents/Resources/gephi/etc. In there you find the file we’re looking for, which can be opened in any text editor. It should look like this:

# ${HOME} will be replaced by user home directory according to platform
default_userdir="${HOME}/.${APPNAME}/0.8.2/dev"
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/0.8.2/dev"

# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="--branding gephi -J-Xms64m -J-Xmx512m -J-Xverify:none -J-Dsun.java2d.noddraw=true -J-Dsun.awt.noerasebackground=true -J-Dnetbeans.indexing.noFileRefresh=true -J-Dplugin.manager.check.interval=EVERY_DAY"
# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea

# default location of JDK/JRE, can be overridden by using --jdkhome  switch
#jdkhome="/path/to/jdk"

# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#extra_clusters=

The relevant part is the second-to-last section (lines 10-11) about the JDK/JRE locations. Here you need to uncomment (i.e. remove the leading # from) the second line and change the contents of the variable jdkhome to match the actual location of the newly installed Java 6 JDK on your system. In my case it looks like this:

# default location of JDK/JRE, can be overridden by using --jdkhome  switch
jdkhome="/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/"

Notice that it is not sufficient to enter the path to the aforementioned ...jdk folder, but instead you have to actually reference the subfolder Contents/Home/! Should you fail to do so you will notice that Gephi won’t start up anymore without any comment or error message. I have to admit that it took me a while to figure this out. The forum post that pointed me into this direction can be found here.

Gephi 0.8.2-beta running on MacOS X 10.8.5

Gephi 0.8.2-beta running on MacOS X 10.8.5

And now we’re done! After installing a Java 6 JDK onto MacOS X 10.8.5 Mountain Lion and pointing Gephi 0.8.2-beta to it, we can actually fire up Gephi and start using it! I hope this quick walkthrough can help at least a few lost souls – just let me know in the comments if you ran into any additional issues.

22 Comments

  1. Darn, I tried this and I still get the “Unable to load libjogl_awt.jnilib” (Gephi 0.8.2, OSX 10.9.1 Mavericks, java -version
    java version “1.7.0_51”
    Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode), 1.6.0_37-b06-434.jdk)

    Reply

    1. Hmm, sorry to hear that. Have you tried deleting the folder /[your_username]/Library/Application Support/gephi? It contains the settings for gephi and can apparently throw the application off at times… (Obviously you need to replace [your_username] with, well, your MacOS username.)

      Reply

  2. Thanks for your reply, sorry I should have mentioned that folder didn’t exist on my machine. I just tried setting up CurrentJDK links and that didn’t work either. It’s a shame I can’t get it working.

    Reply

  3. Thanks a lot for the very helpful post.

    However I am still unable to run Gephi.

    The only difference I see is that I am on MAc OS X 10.9.2.

    I did the following in gephi.conf
    jdkhome=”/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home”

    My jdk has been placed in /System/Library/Java instead of Library/Java

    I have also removed the /[your_username]/Library/Application Support/gephi file.

    Then I can run Gephi but as soon as I try to load a graph (e.g Les Miserabbles) I still have a gray screen and the blue circle showing that something is going wrong.

    Does anyone succeed in running Gephi on MAc OS 10.9.2

    Cheers

    Reply

  4. I’m trying to run neo4j plugin for Gephi, but it requires Java 7 or later. My OS X is 10.9.4 and runs Java 1.8, Gephi runs Java 1.6.

    “Some plugins require the Java platform in version Java > 1.7
    The Java platform version Java > 1.7 was requested but only 1.6 is running. The following plugin is affected: Neo4j Graph Database”

    $ java -version
    java version “1.8.0_05”
    Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

    Reply

  5. … Sorry last Reply was unfinished, here is the full version:

    I’m trying to run neo4j plugin for Gephi, but it requires Java 7 or later. My OS X is 10.9.4 and runs Java 1.8, Gephi runs Java 1.6.

    “Some plugins require the Java platform in version Java > 1.7
    The Java platform version Java > 1.7 was requested but only 1.6 is running. The following plugin is affected: Neo4j Graph Database”

    $ java -version
    java version “1.8.0_05″
    Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

    Does anyone had succeed with this plugin in Mac OSX?.

    Thanks in advance.

    Reply

  6. I was also able to install the package as you suggested (has v1.6) on my mac os x. But I am not able to edit my gephi.conf file -> says Read-only file. Even the drive gephi.dmg is read-only. I tried unlocking by using chmod etc…but it won’t change! What can I do next?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*