Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to set some env variable in OS X 10.6 (/etc/launchd.conf)

setenv M2_HOME /usr/share/maven
setenv M2 $M2_HOME/bin
setenv MAVEN_OPTS '-Xms256m -Xmx512m'

M2 and MAVEN_OPTS are not working.
I tried with something like

setenv MAVEN_OPTS -Xms256m\ -Xmx512m

but still it doesn't work. Any idea of what is the correct synthax?
Thanks

share|improve this question

migrated from stackoverflow.com May 31 '10 at 3:28

This question came from our site for professional and enthusiast programmers.

1  
Shouldnt this all be going in a plist for loading with launchctl? –  prodigitalson May 30 '10 at 15:47
    
Do you mean environment.plist? I refer to this stackoverflow.com/questions/135688/… it says 'environment.plist does not work for applications launched via Spotlight' so I was trying to set the env variables using launchd.conf. It works fine. But It won't work using spaces or if I concat variables using $ –  al nik May 30 '10 at 17:48
    
@al nik: no not environment.plist. i mean a plist to use with Maven as a service - if youre trying to run this as a background service (daemon) then you should be crafting your own plist to launch the daemon and this data would go there. I see from your response below that youre trying to get this var hooked up in IntelliJ instead im guessing? If thats so then i would look for a way to set variables withing IntelliJ. I dont know if it provides this but i know Eclipse does so i would assume there is something similar. –  prodigitalson May 31 '10 at 4:58

3 Answers 3

Try this instead:

export M2_HOME=/usr/share/maven
export M2=$M2_HOME/bin
export MAVEN_OPTS='-Xms256m -Xmx512m'
share|improve this answer
    
it won't work digitaledgesw.com/node/31 –  al nik May 30 '10 at 17:42

While I realize that there are many ways to go about this. If one is just interested in configuring environment variables for IntelliJ then you could do the following without going through a lot of hassle:

IntelliJIDEA -> Preferences -> Path Variables

Now select Add on the right and add your required variables. In my case it is the following as I used homebrew to install Maven:

Name: M2_HOME
Value: /usr/local/Cellar/maven/3.0.4

Now look under IntelliJIDEA -> Preferences -> Maven and everything should be automatically configured. Select OK and now you should be all set. Just so you guys know I use IntelliJ IDEA 11.

Be advised that the above will work only in IntelliJ. If you want this in terminal, put the required stuff in .bash_profile or throw it in /etc/launchd.conf if you want this for GUI's and the terminal. You can find more info on these methods easily doing a quick search.

share|improve this answer

Hope this answer helps after all this time. You find a solution along your lines here. I think your problem is that the stuff in the third row, like $M2_HOME/bin or '-Xms256m -Xmx512m', is not expanded before it gets fed to launchctl. I provided another solution here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.