2

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

al nik
  • 201

3 Answers3

1

Try this instead:

export M2_HOME=/usr/share/maven
export M2=$M2_HOME/bin
export MAVEN_OPTS='-Xms256m -Xmx512m'
1

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.

Nifle
  • 34,998
0

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.