在OSX中永久设置PATH环境变量 [英] Setting PATH environment variable in OSX permanently

查看:97
本文介绍了在OSX中永久设置PATH环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读有关如何将OSX上的环境变量永久设置为几个答案.

首先,我尝试了这个操作,如何在Linux/上永久设置$ PATH Unix吗?,但是我收到一条错误消息,提示no such file and directory,所以我认为我可以尝试使用~/.bash_profile而不是~/.profile,但是它不起作用.

第二,我找到了此解决方案如何在os x 中设置应用程序使用的$ PATH,建议在

中进行更改

〜/.. MacOSX/environment.plist

,但是我又出现了no such file and directory错误.

我需要一种设置这些变量的方法,这样就不必在每次打开新的终端会话时都一次又一次地设置它们.

解决方案

您必须将其添加到/etc/paths.

参考(适用于我):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.

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

but again I had no such file and directory error.

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.

解决方案

You have to add it to /etc/paths.

Reference (which works for me) : Here

这篇关于在OSX中永久设置PATH环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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