苹果下的环境变量

mac os x 10.7.4 以前可以使用 Evironment.plist 来控制全局的环境变量.

但到了 Lion 以后,这个方式被废除了. 同时 修改配置文件的一些方式,也最多会影响到终端的环境变量了..

On Mountain Lion all the /etc/paths and /etc/launchd.conf editing doesn't take any effect!
Apple's Developer Forums say:
"Change the Info.plist of the .app itself to contain an "LSEnvironment" dictionary with the environment variables you want.
~/.MacOSX/environment.plist is no longer supported."




那么如何配置.app的环境变量呢?

最开始我使用了比较trick的方式

从终端运行app.然后app继承了终端的环境变量...


慢慢在英文的世界中,找到如下方案.

Change the Info.plist of the .app itself to contain an "LSEnvironment" dictionary with the environment variables you want.

There will be an Info.plist per application in WhatEver.app/Content/Info.plist.
You can edit it.
Click the "+" on the Information Property List and add a dictionary called LSEnvironment.
If you type it correctly it will rename it to Environment variables. And It changed to a dictionary.
Then you click the "+" by that for each environment variable you want to add under this dirctionary.
QTDIR    /Users/...


关闭应用程序,重启生效...
最关键的一步:你需要使你刚才的改动刷新到系统里面去.
you need to force update the LaunchService database in the Terminal by using the lsregister command:
 使用如下命令.
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/eclipse/XXXX.app


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值