The R extension for Netlogo (available fromneeds sone environment variables to point to R and JRI (an R tool for connecting R and Java). Until Lion, a plist file ~/.MacOSX/environment.plist
could be used to define environment variables which then could be accessed by OSX appellations (started by clicking in Finder)
Mountain Lion does not use the environment.plist
file any more. Therefore, we need other tricks to create these environment variables. The have to be set in the Info.plist
file of the Netlogo applications.
To access this file, got into the Netlogo directory (currently /Applications/Netlogo 5.0.2
) and do Ctrl-Click on the Application (currently Netlogo 5.0.2
or Netlogo 5.0.2.app
, depending on your system settings). Select Show Package Contents
on the drop down menu and then go into the Contents
directory. There, you can see the file Info.plist
We have to add some items to this file. This can be done either with a text editor or with the PList editor in Xcode (if Xcode is installed on the computer).
Editing Info.plist
using a text editor
Ctrl-Click the file Info.plist
and select the editor to open the file in the Open With drop down menu item.
The end of this file will look like this:
<key>NSJavaRoot</key> <string>..</string> </dict> </plist> |
We add a few lines so that the end of the file looks like this:
<key>NSJavaRoot</key> <string>..</string> <key>LSEnvironment</key> <dict> <key>JRI_HOME</key> <string>/Library/Frameworks/R.framework/Resources/library/rJava/jri</string> <key>R_HOME</key> <string>/Library/Frameworks/R.framework/Resources</string> </dict> </dict> </plist> |
Save the file. From now on, the R extension of Netlogo should work.
Editing Info.plist
using XCode
If Xcode is installed, just double clicking Info.plist
will open it in the PList editor of Xcode.
On the menu, close Editor
and then click in on then Show Raw Keys & Values
item . It needs to be checked with a check mark. The editor window displays a few lines. The last line should be Java root directory
. Select the line and on the Xcpde menu do Editor -> Add Item
. A new line will appear; on the dropdown of this line, select LSEnvironment
.
The editor then will set the type to dictionary. Click on the triangle to the left of LSEnvironment
to make it point down. Now click the + sign on the LSEnvironment
line. In the new line, the value for key is New item
and the Type is String
. Set the value for key to JRI_HOME
to /Library/Frameworks/R.framework/Resources/library/rJava/jri
.
In the same way, create a second key R_HOME
and set its value to /Library/Frameworks/R.framework/Resources/library/rJava/jri
.
Save the file.
The R extension of Netlogo now should work.