osx - Setting environment variables in OS X? -
what proper way modify environment variables path in osx? i've looked on google little bit , found 3 different files edit:
- /etc/paths
- ~/.profile
- ~/.tcshrc
i don't have of these files, , i'm pretty sure .tcshrc wrong, since osx uses bash now. have idea these variables, path, defined?
edit: i'm running os x 10.5
bruno right on track. i've done extensive research , if want set variables available in gui apps, option /etc/launchd.conf
please note environment.plist not work applications launched via spotlight. documented steve sexton here.
1) open terminal prompt
2) type sudo vi /etc/launchd.conf
(note: file might not yet exist)
3) put contents following file
# set environment variables here available globally apps # (and terminal), including launched via spotlight. # # after editing file run following command terminal update # environment variables globally without needing reboot. # note: still need restart relevant application (including # terminal) pick changes! # grep -e "^setenv" /etc/launchd.conf | xargs -t -l 1 launchctl # # see http://www.digitaledgesw.com/node/31 # , http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x/ # # note must hardcode paths below, don't use enviroment variables. # need surround multiple values in quotes, see maven_opts example below. # setenv java_version 1.6 setenv java_home /system/library/frameworks/javavm.framework/versions/1.6/home setenv groovy_home /applications/dev/groovy setenv grails_home /applications/dev/grails setenv nexus_home /applications/dev/nexus/nexus-webapp setenv jruby_home /applications/dev/jruby setenv ant_home /applications/dev/apache-ant setenv ant_opts -xmx512m setenv maven_opts "-xmx1024m -xx:maxpermsize=512m" setenv m2_home /applications/dev/apache-maven setenv jmeter_home /applications/dev/jakarta-jmeter
4) save changes in vi , reboot mac. or use grep/xargs command shown in code comment above.
5) prove variables working opening terminal window , typing export
, should see new variables. these available in intellij , other gui apps launch via spotlight.
Comments
Post a Comment