简体   繁体   English

无法在Mac OS X Yosemite上修改$ PATH

[英]Not able to modify $PATH on Mac OS X Yosemite

i just want to start with developing Android Apps on my new mac. 我只想开始在我的新Mac上开发Android应用程序。 Therefore i have to add platform-tools and tools from the Eclipsebundle to my $PATH. 因此,我必须将Eclipsebundle中的平台工具和工具添加到我的$ PATH中。

The first thing i did was to add these two folders on my local Administrator-Account which worked fine with the command: 我做的第一件事是在我的本地管理员帐户上添加这两个文件夹,该命令工作正常:

echo 'export PATH=/Users/myname/Desktop/adtbundle/sdk/platform-tools:"$PATH"' >> ~/.profile
echo 'export PATH=/Users/myname/Desktop/adtbundle/sdk/tools:"$PATH"' >> ~/.profile

So, then i added the MacMini into our Company-Domain and logged in with my Account which is saved in our active directory. 所以,然后我将MacMini添加到我们的公司域中并使用我的帐户登录,该帐户保存在我们的活动目录中。

I opened up the Terminal again and typed the two commands, but after that, while i want to verify my new $PATH ( echo $PATH ), my $PATH didn't change. 我再次打开了终端并键入了两个命令,但在那之后,当我想验证我的新$ PATH( echo $PATH )时,我的$ PATH没有改变。 Just the standard folders are in it. 只是标准文件夹在其中。

I looked for another How-To to edit the $PATH and tryed it like this: 我找了另一个编辑$ PATH的方法,并尝试这样:

cd

nano .bash_profile

in my .bash_profile i added: 在我的.bash_profile中我添加了:

export PATH="/Users/myname/Desktop/adtbundle/sdk/platform-tools:$PATH"
export PATH="/Users/myname/Desktop/adtbundle/sdk/tools:$PATH"

saved all with control + o confirmed the name by pressing return and then exit nano by clicking control + x 保存所有control + o通过按return确认名称,然后通过单击control + x退出nano

tryed to verify my new $PATH -> it did not change and my bash_profile is empty again - can someone tell me, what i did wrong? 试图验证我的新$ PATH - >它没有改变,我的bash_profile再次为空 - 有人可以告诉我,我做错了什么?

THIS WORKED FOR ME http://www.cyberciti.biz/faq/appleosx-bash-unix-change-set-path-environment-variable/ 这为我工作 http://www.cyberciti.biz/faq/appleosx-bash-unix-change-set-path-environment-variable/

After editing .bash_profile, refresh the bash enviroment by restarting Terminal or typing the following command: 编辑.bash_profile后,通过重新启动终端或键入以下命令来刷新bash环境:

source ~/.bash_profile

' source ' command will execute the contents of the argument supplied. ' source '命令将执行提供的参数的内容。

After you add path to .bash_profile quit the terminal and open it again. 添加.bash_profile路径后,退出终端并再次打开它。 the try to echo $PATH. 尝试回显$ PATH。 It worked for me. 它对我有用。 else you can add path to /etc/profile. 否则你可以添加/ etc / profile的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM