How come when I type "rails", it won't work... but when I type "/var/lib/gems/1.8/bin/rails" it will work? How do I bind it so that I don't have to type the full path everytime?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You need to edit your $PATH
environmental variable.
For example, in your .bashrc
:
export PATH=$PATH:/var/lib/gems/1.8/bin
Alternatively, you can use an alias, in your .bashrc
:
alias rails=/var/lib/gems/1.8/bin/rails
Or you could even put the rails binary (or a symlink) to one of the directories listed in your $PATH
. To see those directories, type echo $PATH
.
回答2:
You can create a soft link:
ln -s /var/lib/gems/1.8/bin/rails /usr/local/bin
Then you can run rails
directly.