如何在ubuntu 12.0.4上添加usr / local / bin到路径环境变量?

时间:2023-01-06 23:20:20

I have just installed ruby.1.8.6 on unbuntu 12.0.4.

我刚刚在unbuntu 12.0.4上安装了ruby.1.8.6。

I am learning ruby out of a book and after the installation process it says

我正在学习书中的红宝石,并在安装过程之后说

"Once it’s completed, you should add /usr/local/bin to your PATH environment variable. I’ll assume that, being a Linux user"

“一旦完成,你应该将/ usr / local / bin添加到你的PATH环境变量。我会假设,作为Linux用户”

And im stuck as the guy has a wrong assumption.

而我坚持认为这个家伙有一个错误的假设。

How do I add usr/local/bin to the path environment variable.

如何将usr / local / bin添加到路径环境变量中。

2 个解决方案

#1


15  

You can add this to your ~/.bashrc file:

您可以将其添加到〜/ .bashrc文件中:

PATH=$PATH:/usr/local/bin

If you don't know how, you can just execute this line in a Terminal:

如果您不知道如何,您可以在终端中执行此行:

echo "PATH=\$PATH:/usr/local/bin" >> ~/.bashrc

You can also check what's in your PATH by typing in the Terminal

您还可以通过在终端中输入来检查PATH中的内容

echo $PATH

#2


7  

for the current terminal session, you can:

对于当前的终端会话,您可以:

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

For a more permanent solution, edit ~/.bashrc and add the line above

要获得更持久的解决方案,请编辑〜/ .bashrc并添加上面的行

#1


15  

You can add this to your ~/.bashrc file:

您可以将其添加到〜/ .bashrc文件中:

PATH=$PATH:/usr/local/bin

If you don't know how, you can just execute this line in a Terminal:

如果您不知道如何,您可以在终端中执行此行:

echo "PATH=\$PATH:/usr/local/bin" >> ~/.bashrc

You can also check what's in your PATH by typing in the Terminal

您还可以通过在终端中输入来检查PATH中的内容

echo $PATH

#2


7  

for the current terminal session, you can:

对于当前的终端会话,您可以:

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

For a more permanent solution, edit ~/.bashrc and add the line above

要获得更持久的解决方案,请编辑〜/ .bashrc并添加上面的行