首页 > 代码库 > 亲测可行的Yosemite设置环境变量方法

亲测可行的Yosemite设置环境变量方法

Adding in a Permanent Location

To make the new path stick permanently you need to create a .bash_profile file in your home directory and set the path there. This file control various Terminal environment preferences including the path.

cd

Move into home directory

nano .bash_profile

Create the .bash_profile file with a command line editor called nano

export PATH="/usr/local/mysql/bin:$PATH"

Add in the above line which declares the new location /usr/local/mysql/bin as well as the original path declared as $PATH.

技术分享

Save the file in nano by clicking ‘control’ +’o’ and confirming the name of the file is .bash_profileby hitting return. And the ‘control’+’x’ to exit nano

 

So now when the Terminal is relaunched or a new window made and you check the the path by

echo $PATH

You will get the new path at the front followed by the default path locations, all the time

/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin


亲测可行的Yosemite设置环境变量方法