[R-SIG-Mac] Cocoa gui with embedded R framework

Kjell Konis konis at stats.ox.ac.uk
Thu Mar 24 16:19:33 CET 2005

> In fact, it's as simple as this:
> setenv("R_HOME", [[[NSBundle 
> bundleWithIdentifier:@"org.r-project.R-framework"] resourcePath] 
> UTF8String], 1);

I made the following change in REngine.m and now I can move R.app 
around and it will still launch.  It's a little more complicated but it 
always loads the embedded R.framework.


- (REngine*) initWithHandler: (id <REPLHandler>) hand arguments: 
(char**) args
	NSString* mainBundlePath = nil;
	NSString* rhomePath = nil;


	mainBundlePath = [[NSBundle mainBundle] resourcePath];
	rhomePath = [[mainBundlePath stringByDeletingLastPathComponent] 

     setenv("R_HOME", [rhomePath UTF8String], 1);


	return self;

More information about the R-SIG-Mac mailing list