To install the RVM command:
Copy Code code as follows:
Bash < < (Curl Http://rvm.beginrescueend.com/releases/rvm-install-head)
Then modify the user profile/users/username/.profile, and you can also write to other global configurations.
Add one line of code:
Copy Code code as follows:
[[s] $HOME/.RVM/SCRIPTS/RVM]] &&. "$HOME/.RVM/SCRIPTS/RVM" # This loads RVM to a shell session.
If "$HOME/.RVM/SCRIPTS/RVM" exists, the execution
Reboot the TERMINAL,RVM and install it. There is no need to use Sudo,gem in the process of RVM.
You can then install Ruby, for example:
Copy Code code as follows:
RVM Install ruby-1.8.7--head--docs
--docs is automatically generated after compiling the installation,--head is the latest version
Delete a version of Ruby and delete both the document and the gems:
Copy Code code as follows:
RVM Remove ruby-1.8.7--docs--gems
Select version:
Copy Code code as follows:
RVM Use ruby-1.8.7--default
Query Current version:
Copy Code code as follows:
List version:
Copy Code code as follows:
RVM In addition to managing different versions of Ruby, you can create different gem collections (gemsets) for each Ruby version so that different Ruby applications can use their own gem collections independently. For example, in the case of using ruby-1.9.2-p290, I need to build two rails projects, one using rails-3.0, one using rails-3.1.0, we can create two gemset, and install the corresponding rails version and other gems under each gemset respectively:
Copy Code code as follows:
RVM Gemset Create rails-3.0 #创建名为rails-3.0 Gemset
RVM 1.9.2-p290@rails-3.0 #使用ruby -1.9.2-p290 and use rails-3.0 Gemset
Gem Install RAILS-V 3.0 #在rails -3.0 Gemset installs Rails version 3.0
RVM gemset Create rails-3.1.0 #创建名为rails -3.1.0 gemset
RVM 1.9.2-p290@rails-3.1.0 #使用ruby -1.9.2-p290 and use rails-3.1.0 Gemset
Gem install rails-v 3.1.0 #在rails -3.0 Gemset installs Rails 3.1.0 version
More commands, accessing http://rvm.beginrescueend.com/rvm/