事前準備
- 需要
curl
,wget
不行,因為安裝指令檔內是用curl
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
安裝
curl -sSL get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
,載入 rvm 為 function
更新
rvm get stable
rvm get head
Ruby 相關
rvm list known
- 已安裝的:
rvm list [rubies]
rvm install <version>
(--disable)--binary
--with*
./configure
選項-C <comma sep>
其他./configure
選項export optflags="-O0 -ggdb"
編譯選項
source $(rvm <version> do rvm env --path)
- 若未將 rvm 載入為 function,則可用此行將
ruby
加到$PATH
- 若未將 rvm 載入為 function,則可用此行將
使用 Ruby (default 為 system
)
rubies 為已安裝 Ruby 或
system
,後面可加@<gemsets>
rvm [use] <rubies>
暫時性rvm [use] --default <rubies>
設定預設值rvm reset
=rvm use system
rvm gemsets 與 bundler 關係
http://stackoverflow.com/questions/4361645/relationships-between-rubygems-bundler-and-rvm
Note: 執行 bundler 內可執行檔時需前綴 bundle exec
,但 rvm>=1.11.0
預設安裝 rubygems-bundler
已解決此問題。1
rvmrc(所有版本適用,但只紀錄與 rbenv
相容的用法)
.ruby-version
、.ruby-gemset
分別存放- 可用
rvm --ruby-version use <rubies>[@gemsets]
建立兩檔
參考資料
TODO: rvm isn’t func
https://rvm.io/support/faq#what-shell-login-means-bash-l https://ruby-china.org/topics/3705 https://rvm.io/workflow/scripting
TODO: chruby, rbenv, rvm
http://kgrz.io/2014/02/13/Programmers-guide-to-choosing-ruby-version-manager.html
TODO:completion
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion