gem_path not respected by intellij
Answered
I am using intellij ultimate 200=17.2
I have a simple jruby project I want to integrate with intellij.
I run intellij in my mac this way (via the script below) so I inherit environment variables:
source setenv.sh
JAVA_HOME=/Library/Java/Home
cd /Applications
open IntelliJ\ IDEA.app/
in particular, I set GEM_HOME and GEM_PATH, which I need to find some gems used by my project
but when I go to tools -> show gem enviroment I see that my GEM_PATH has not bee respected, so I cannot test, run or debug my project
1. why GEM_PATH from the env is not respected?
2. How do I configure this so it can use my GEM_PATH?
Please sign in to leave a comment.
Setting environment on Mac is tricky, it depends on the macOS version and the way the app is started.
Please check these answers to find which one works for you:
http://apple.stackexchange.com/q/51677
http://apple.stackexchange.com/q/57385/17551
http://stackoverflow.com/q/135688/104891
Hi Serge,
I am using macOS 10.12.6.
solution 1 doesn't work (adding to .bash_profile)
solution 2 is really old, and I cannot is not workable (applescirpt dependency)
solution 3 doesn't work (adding to /etc/lauchd.conf)
My solution used to work until I updated yourkit. If macOs is supprted, please give me a definite answer. I can make no progress until this gets resolved.
thanks for your help,
fdo
See https://stackoverflow.com/questions/25385934/setting-environment-variables-via-launchd-conf-no-longer-works-in-os-x-yosemite answer for the latest macOS versions.
The problem you have has no relation to JetBrains products, but how macOS manages environment variables for different application types.
I am adding [1], restarting and then invoking intellij (via spotlight). I still see the wrong GEM PATHS:
GEM PATHS:
/Users/fcastano/dev/qa/SysTest/perfEngSearch/srrc/jruby/jruby-1.7.19/lib/ruby/gems/shared
/Users/fcastano/.gem/jruby/1.9
so this is not working either. Am I doing something wrong?
[1]
fcastano-ltm8:bin fcastano$ more ~/Library/LaunchAgents/
com.citrixonline.GoToMeeting.G2MUpdate.plist com.logmein.GoToMeeting.G2MUpdate.plist environment.plist
fcastano-ltm8:bin fcastano$ more ~/Library/LaunchAgents/environment.plist
CTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>my.startup</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>
launchctl setenv GEM_HOME /Users/fcastano/dev//qa/SysTest/perfEngSearch/srrc/jruby_gem_home/
launchctl setenv GEM_PATH /Users/fcastano/dev//qa/SysTest/perfEngSearch/srrc/jruby/jruby-1.7.19/lib/ruby/gems/shared:/Users/fcastano/dev//qa/SysTest/perfEngSearch/srrc/jruby_gem_home/
</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Check idea.log (https://intellij-support.jetbrains.com/hc/articles/207241085). It runs a py script to detect the environment. You can try running it manually to see the results returned.
If it still doesn't work, please file a bug at https://youtrack.jetbrains.com/issues/RUBY with the steps to reproduce.
issue created: https://youtrack.jetbrains.com/issue/RUBY-20050
-fdo