OK thanks for explaining it Mark. I'm afraid setting the variable again in Xcode is not an option. I was hoping to pick up $CATALINA_HOME to find out where a user had installed tomcat. On 17 Oct 2012, at 21:51, Mark Rada <mrada@marketcircle.com> wrote:
Ok, so it looks like you are setting the environment variable from the Terminal.app, and then running the app from Xcode or launching from Finder.
If that's the case, then what you export from the Terminal would not be available to apps. Exported variables will only be available to descendant processes. The parent process of your app is a launchd process for your user; and that launchd process has a parent of the root launchd process (and it doesn't have a parent). You can see the hierarchy when you run Activity Monitor and use the "All Processes, Hierarchically" filter.
A shell session in Terminal will be a child of Terminal; and if you run a program from that shell it will be a child of the shell, which is why you can see the exported variable from macirb.
If you are using Xcode, try editing the Scheme for running the app. The "Run" stage should have a list of environment variables that can be set and you can add your variables there instead.
HTH, Mark
On 2012-10-17, at 11:39 AM, Erik Lundqvist <willcodejavaforfood@gmail.com> wrote:
Dear all,
Started playing with MacRuby again and I need to access the environment variables.
Say I have a export VARIABLE_NAME = Whatever
I have tried both: ENV['VARIABLE_NAME'] and NSProcessInfo.processInfo.environment.objectForKey('VARIABLE_NAME')
Neither of which returns anything
Both works in macirb
Kind Regards, Erik _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/macruby-devel