[email protected]:~$ rbenv global
1.9.3-p392
[email protected]:~$ rbenv local
1.9.3-p392
[email protected]:~$ which ruby-build
/usr/local/bin/ruby-build
[email protected]:~$ rbenv versions
* 1.9.3-p392 (set by /home/hyperrjas/.ruby-version)
[email protected]:~$ rbenv version
1.9.3-p392 (set by /home/hyperrjas/.ruby-version)
[email protected]:~$ rbenv rehash
[email protected]:~$ ruby -v
-bash: ruby: command not found
[email protected]:~$ env | grep PATH
PATH=/home/hyperrjas/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
[email protected]:~$ export PATH="$HOME/.rbenv/bin:$PATH"
[email protected]:~$ ruby -v
-bash: ruby: command not found
我正在使用Ubuntu 12.04。-bash:ruby:command not found
這是我~/.profile
文件:
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
eval "$(rbenv init -)"
eval "$(rbenv init -)"
我已經安裝了紅寶石rbenv最後一個版本,當我嘗試ruby -v
我得到-bash: ruby: command not found
我認爲你需要運行一個添加ruby到你的$ PATH的命令,不幸的是我不知道是什麼那個命令是,祝你好運! – OneChillDude 2013-04-04 19:17:34
FWIW,你可以考慮轉向[RVM](http://rvm.io) – 2013-04-04 19:20:07
RVM和rbenv同樣好。 rbenv重量更輕,並且更簡單,移動部件更少。 RVM有很多功能,還有更多的事情會出錯。 – 2013-04-04 19:23:33