[rails4]RVM移除與安裝

說明:

之前裝RVM沒有裝好,導致gem套件在安裝時都必須要加上sudo才有辦法繼續安裝。

原本不以為意,頂多安裝套件時加一下sudo就可以了。當然事情沒有這麼簡單就解決,gem有沒有加sudo安裝位置是不一樣,導致一些從網路上clone下來的程式bundle install會出現一些我無法解決的問題。

剛好今晚突然心血來潮,索性來研究一下如何安裝gem不用加上sudo

1. 移除OSX舊有RVM

$ rvm implode
其他注意事項:

Note you may need to manually remove /etc/rvmrc and ~/.rvmrc if they exist still.
Please check all .bashrc .bash_profile .profile and .zshrc for RVM source lines and delete or comment out if this was a Per-User installation.
Also make sure to remove ‘rvm’ group if this was a system installation.
Finally it might help to relogin / restart if you want to have fresh environment (like for installing RVM again).

參考網址:RVM Implode / Uninstall and RVM Install

2. 重新安裝RVM

$ curl -L https://get.rvm.io | bash -s stable

重新啟動終端機,讓RVM生效。

其餘步驟參考網址:
  1. Mac OSX 10.9 安裝Rails 4.0 開發環境
  2. setup mac development

註. 解決rvm use 2.0.0失敗問題

使用rvm use 2.0.0 --default出現了

RVM is not a function, selecting rubies with rvm use ... will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use /bin/bash --login as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

解決方法:
$ subl ~/.profile
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

第二行路徑添加進去,就可以使用rvm use ..

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *