2013-04-04 24 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 

Sto lavorando con Ubuntu 12.04.-bash: ruby: comando non trovato

Questo è il mio ~/.profile di 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 -)" 

Ho installato rubino ultima versione con rbenv e quando provo ruby -v ottengo -bash: ruby: command not found

+0

Credo che è necessario eseguire un comando che aggiunge ruby ​​al tuo $ PATH, sfortunatamente non ho idea di cosa questo comando è, buona fortuna! – OneChillDude

+0

FWIW, si può prendere in considerazione lo spostamento verso [RVM] (http://rvm.io) –

+0

RVM e rbenv sono ugualmente buoni. rbenv è più leggero e meno complicato, con meno parti mobili. RVM ha molte capacità e molte più cose vanno male. –

risposta

9

rbenv ha bisogno di questi alla fine del tuo ~/.bash_profile:

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

Usa grep rbenv ~/.bash_profile per vedere se ci sono.

In caso contrario, esegue:

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

e si dovrebbe essere installato e funzionante.

Vedere i passaggi 2 e 3 in the docs per ulteriori informazioni.

Ulteriori informazioni su .bashrc, .bash_profile e .profile si possono trovare in:

+0

'rbenv init' abilita gli shim e il completamento automatico. – Stefan

+0

Ho aggiunto alla domanda il mio file '~/.profile'. Grazie – hyperrjas

+0

Non capisco perché in rbenv doc specificare se stai usando Ubuntu è possibile aggiungere ** Nota di Ubuntu **: 'Modifica il tuo ~/.profile invece di ~/.bash_profile. Se con '~/.profile' non funziona, perché è specificato in doc? – hyperrjas

3

Run env | grep PATH e assicurarsi di avere $HOME/.rbenv/bin nel tuo PATH .

Se non lo è, aggiungilo a ~/.bash_profile.

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

Grazie, ci ho provato, ma ottengo lo stesso risultato. Questo è il mio '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' Grazie – hyperrjas

+1

Apre una nuova finestra di terminale. Le modifiche verranno applicate al successivo accesso alla finestra del terminale. –