在 OSX 中永久设置 PATH 环境变量 [英] Setting PATH environment variable in OSX permanently
问题描述
我已经阅读了几个关于如何在 OSX 上永久设置环境变量的答案.
I have read several answers on how to set environmental variables on OSX as permanently.
首先,我尝试了这个,如何在 Linux 上永久设置 $PATH/Unix? 但我有一条错误消息说没有这样的文件和目录
,所以我想我可以试试 ~/.bash_profile
而不是 ~/.profile
但它不起作用.
First, I tried this, How to permanently set $PATH on Linux/Unix? but I had an error message saying no such file and directory
, so I thought I could try ~/.bash_profile
instead of ~/.profile
but it did not work.
其次,我找到了这个解决方案 如何在 os x 中设置应用程序使用的 $PATH ,建议在
Second, I found this solution How to set the $PATH as used by applications in os x , which advices to make changes in
~/.MacOSX/environment.plist
~/.MacOSX/environment.plist
但我再次遇到没有这样的文件和目录
错误.
我需要一种方法来设置这些变量,这样每次打开新的终端会话时就不需要一次又一次地设置它们.
I need a way to set these variables such that it won't require to set them again and again each time I open a new terminal session.
推荐答案
你必须把它添加到/etc/paths
.
参考(对我有用):这里
这篇关于在 OSX 中永久设置 PATH 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!