如何在OS X中设置应用程序使用的$ PATH [英] How to set the $PATH as used by applications in os x

查看:82
本文介绍了如何在OS X中设置应用程序使用的$ PATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ant来构建我的项目,并使用'svnversion'可执行文件在我的源代码中插入一个版本ID,以便于跟踪版本.

I'm using ant to build my project, and use the 'svnversion' executable to insert a version id into my sources for easy tracking of versions.

从命令行运行此ant文件有效,我在.profile中设置了$ PATH来包含svnversion的路径,并且运行良好.

Running this ant file from the command line works, I've set my $PATH in .profile to include the path to svnversion and it works fine.

现在,我尝试从Eclipse内部运行该相同的ant文件,但该文件不起作用-eclipse中的PATH的设置方式不同于shell的PATH,我怀疑这必须在某个位置的plist中设置,但是我不知道在哪里.

Now I try and run this same ant file from inside Eclipse and that does not work - the PATH in eclipse is set in another way than the PATH of the shell, I suspect this has to be set in a plist somewhere, but I don't know where.

推荐答案

正确-位于plist文件中

Correct -- it's in the plist file

~/.MacOSX/environment.plist

此文件实际上包含整个登录会话中要设置的任何环境变量的键/值对.与.profile/.cshrc等不同,它可用于GUI程序.不幸的是,您不能在这里访问其他环境变量(例如,不能使用$ HOME)或使用任何其他程序结构.

This file actually contains key-value pairs for any environment variables you want to set, for the whole login session. Unlike .profile/.cshrc etc, it's available to GUI programs. Unfortunately, you can't access other environment variables (e.g., you can't use $HOME) or use any other programmatic constructs here.

更新:请注意,a,OS X 10.8 Mountain Lion不再支持此功能.

Update: note that this is no longer supported under OS X 10.8 Mountain Lion, alas.

这篇关于如何在OS X中设置应用程序使用的$ PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆