栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在OS X上设置环境变量

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在OS X上设置环境变量

布鲁诺是正确的。我已经进行了广泛的研究,如果您想设置所有GUI应用程序中都可用的变量,则唯一的选择是

/etc/launchd.conf

  1. 打开终端提示

  2. 类型sudo vi /etc/launchd.conf(注意:此文件可能尚不存在)

  3. 将如下内容放入文件中

# Set environment variables here so they are available globally to all apps# (and Terminal), including those launched via Spotlight.## After editing this file run the following command from the terminal to update# environment variables globally without needing to reboot.# NOTE: You will still need to restart the relevant application (including# Terminal) to pick up the changes!# grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl## See http://www.digitaledgesw.com/node/31# and http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x/## Note that you must hardpre the paths below, don't use environment variables.# You also need to surround multiple values in quotes, see MAVEN_OPTS example below.#setenv JAVA_VERSION 1.6setenv JAVA_HOME /System/Library/frameworks/JavaVM.framework/Versions/1.6/Homesetenv GROOVY_HOME /Applications/Dev/groovysetenv GRAILS_HOME /Applications/Dev/grailssetenv NEXUS_HOME /Applications/Dev/nexus/nexus-webappsetenv JRUBY_HOME /Applications/Dev/jrubysetenv ANT_HOME /Applications/Dev/apache-antsetenv ANT_OPTS -Xmx512Msetenv MAVEN_OPTS "-Xmx1024M -XX:MaxPermSize=512m"setenv M2_HOME /Applications/Dev/apache-mavensetenv JMETER_HOME /Applications/Dev/jakarta-jmeter
  1. 在vi中保存所做的更改,然后重新启动Mac。或使用上面的代码注释中显示的grep/xargs命令。

  2. 通过打开“终端”窗口并键入来证明您的变量正在工作,export并且您应该看到新的变量。这些也将在IntelliJ IDEA和您通过Spotlight启动的其他GUI应用程序中提供。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/617271.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号