2011-08-21 70 views
0

安裝Ruby我一直on Rails的在Mac上從本網站安裝Ruby教程以下未發現:RVM而on Rails的

http://ruby.railstutorial.org/

我安裝RVM,它不能正常工作。本教程說輸入以下命令:

~ $ [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 

後,我這樣做,它似乎,它說這已成功加載:

~ DUFF$ rvm reload 
RVM reloaded! 
~ DUFF$ rvm notes 
Notes for Darwin (Mac OS X) 
For Lion, Rubies should be built using gcc rather than llvm-gcc. Since 
/usr/bin/gcc is now linked to /usr/bin/llvm-gcc-4.2, add the following to 
your shell's start-up file: export CC=gcc-4.2 
(The situation with LLVM and Ruby may improve. This is as of 07-23-2011.) 

For Snow Leopard be sure to have Xcode Tools Version 3.2.1 (1613) or later 
You should download the latest Xcode tools from developer.apple.com. 
    (This is since the dvd install for Snow Leopard contained bugs). 

If you intend on installing MacRuby you must install LLVM first. 
If you intend on installing JRuby you must install the JDK. 
If you intend on installing IronRuby you must install Mono (version 2.6 or greater is recommended). 

To seamlessly abandon the Apple-installed system ruby (ruby 1.8.7 patchlevel 174 for Snow Leopard): 

rvm install 1.8.7 # installs patch 302: closest supported version 
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system # migrate your gems 
rvm --default 1.8.7 


NOTE: For all installations, as of 1.7, RVM no longer autoloads .rvmrc files. In order to  return this functionality, you MUST add 'export rvm_project_rvmrc=1' to your $HOME/.rvmrc file. This causes RVM to override 'cd' which, while toggleable even < 1.7, is currently defaulted to 'off'. This knob returns the previous behaviour to active which causes per-project .rvmrc files to be loaded once again. 

例如:echo '出口rvm_project_rvmrc = 1' >> $ HOME /.rvmrc & & RVM重裝

所以,畢竟我進入這個遵醫囑:

type rvm | head -n1 

,它說:

-bash: type: rvm: not found 

這樣長的介紹後,我的問題是你知道它爲什麼不承認RVM類型它似乎已經安裝之後。我是一個完整的新手,所以請溫柔。我一直在討論很多問題,直到現在這個問題似乎都很順利。

任何幫助,將不勝感激。謝謝。

回答

1

您是否正在學習本教程? http://beginrescueend.com/rvm/install/

您應該運行此命令全:

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile 

這樣它添加到你的.bash_profile文件,並在每一個新的終端加載。您輸入的命令只會爲單個終端會話加載rvm函數。

.rvm/scripts/rvm是一個shell腳本,它將所有必要的函數加載到您的環境中。

+0

感謝您的答覆。我試過這個命令,我仍然得到相同的迴應。但是,我是一個新手,我可能會錯誤地進行測試。要查看它是否有效,我只需鍵入: rvm --version 這就是我如何看到它的工作原理。我仍然收到說沒有找到rvm命令的錯誤。我很困惑。 – Matt

+0

首先,您應該驗證您是否運行'cat〜/ .bash_profile'正確運行命令,並確保您看到[[-s「$ HOME/.rvm/scripts/rvm」]] &&。 「$ HOME/.rvm/scripts/rvm」#在輸出結尾處加載RVM函數。如果你這麼做,像@jonallard建議的那樣,打開一個新的終端,或運行命令'source〜/ .bash_profile'來重新加載你的環境。你還應該通過列出目錄「ls〜/ .rvm」來確保你擁有所有的rvm腳本。你應該看到bin,腳本,配置等等。如果一切都失敗,請刪除rvm目錄'sudo rm -R〜/ .rvm'並從頂部開始。 –

+0

另外,如果你重新開始,我建議從最新的git版本安裝,運行'bash <<(curl -s https://rvm.beginrescueend.com/install/rvm)',注意'bash'不是一些佔位符爲您的shell提示符,它的命令的一部分...對不起,以解釋但不知道你怎麼noob ...哈哈 –

0

看一看the same question I posted some time ago.

的安裝指南說,在終端「註冊」 RVM這樣:

user$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile 

基本上,當你在你的shell加載RVM功能,在那裏你」重新放置指令取決於你的分佈;這裏是進入.bash_profile。作爲Ubuntu的用戶,我發現使用.bashrc而不是.bash_profile效果更好。

.bash_profile.bashrc之間的差額,這裏概述:http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

+0

感謝您的回覆。我嘗試過,似乎沒有工作,儘管我已經與不同的人的建議非常混亂,我不知道我是否會把它弄得更糟。我也檢查過你提到的上一個線程。它說,要刪除以前的安裝,然後再試一次。我如何刪除以前的安裝?對於新問題抱歉。我們必須從某個地方開始,對吧? – Matt

+1

發出'user $ echo'[[-s「$ HOME/.rvm/scripts/rvm」]] &&後。 「$ HOME/.rvm/scripts/rvm」#加載RVM函數'>>〜/ .bashrc'(注意「rc'」,你試過關閉並重新打開你的終端窗口嗎? –

+0

工作。幫助這個newb出來! – Matt