rJava load error in RStudio/R after upgrading to OS X El Capitan

It appears that every time there is an upgrade of OS X, rJava will break. I had this experience with Yosemite and now El Capitan as well.

After many hours of figuring out what went wrong, it came down to the “Rootless” security feature in OS X.

Previously, I was able to run rJava on Yosemite following the instructions found on this forum post on Stack Overflow here. When you eventually run the command:

sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/lib

the following error will appear:

rJava Issues-1

This is because the “Rootless” security feature in OS X El Capitan will no longer allow us to write to /usr/lib. Instead, you should be running the command

sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib

Note that the path should now be /usr/local/lib. This will create the symbolic link that will allow R/RStudio to load the ibjvm.dylib and enable rJava to run properly.

Hope this will be helpful to those who are struggling with rJava on El Capitan!

Here are some other links about the Rootless security feature in OSX (courtesy of Arstechnica and Apple)


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s