2013-04-04 18 views
7
[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 

Pracuję z Ubuntu 12.04.-bash: ruby: polecenie nie znaleziono

To mój ~/.profile file:

# ~/.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 -)" 

Mam zainstalowany rubin ostatnia wersja z rbenv i gdy próbuję ruby -v uzyskać -bash: ruby: command not found

+0

myślę, że trzeba uruchomić polecenie, które dodaje ruby ​​do twojej $ PATH, niestety nie mam pojęcia co to polecenie jest, powodzenia! – OneChillDude

+0

FWIW, możesz rozważyć przejście w kierunku [RVM] (http://rvm.io) –

+0

RVM i rbenv są równie dobre. rbenv jest lżejszy i mniej skomplikowany, z mniejszą ilością ruchomych części. RVM ma wiele możliwości i wiele innych rzeczy może pójść nie tak. –

Odpowiedz

9

rbenv Potrzeby te w końcu ~/.bash_profile:

export PATH="$HOME/.rbenv/bin:$PATH" 
eval "$(rbenv init -)" 

Zastosowanie grep rbenv ~/.bash_profile aby zobaczyć czy są tam.

Jeśli nie, uruchom:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile 
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile 
exec $SHELL -l 

i powinien być uruchomiony.

Aby uzyskać więcej informacji, zobacz kroki 2 i 3 w dokumencie the docs.

Dodatkowe informacje na .bashrc, .bash_profile i .profile można znaleźć w:

+0

'rbenv init' umożliwia podkładki i autouzupełnianie. – Stefan

+0

Dodałem do pytania mój plik '~/.profile'. Dziękuję – hyperrjas

+0

Nie rozumiem, dlaczego w dokumencie rbenv określić, czy używasz ubuntu możliwe jest dodanie ** Uwaga Ubuntu **: 'Zmodyfikuj swój ~/.profile zamiast ~/.bash_profile. Jeśli z '~/.profile' nie działa, dlaczego jest określony w doc? – hyperrjas

3

Uruchom env | grep PATH i upewnij się, że masz $HOME/.rbenv/bin w PATH .

Jeśli nie, dodaj to do ~/.bash_profile.

export PATH="$HOME/.rbenv/bin:$PATH" 
+0

Dziękuję Próbowałem z tym, ale mam taki sam wynik. To jest moje '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' Dziękuję – hyperrjas

+1

Otwórz nowe okno terminala. Twoje zmiany zostaną zastosowane przy następnym logowaniu do okna terminalu. –

Powiązane problemy