RVM Installation and Use Summary notes, rvm summary notes
Run the following command to install RVM:
Copy codeThe Code is as follows:
Bash <(curl http://rvm.beginrescueend.com/releases/rvm-install-head)
Then modify the user configuration file/Users/username/. profile. You can also write it to other global configurations.
Add a line of code:
Copy codeThe Code is as follows:
[[-S "$ HOME/. rvm/scripts/rvm"] &. "$ HOME/. rvm/scripts/rvm" # This loads RVM into a shell session.
If "$ HOME/. rvm/scripts/rvm" exists, run
Restart Terminal and RVM has been installed. sudo is not required during RVM usage, and gem is not required.
Then you can install ruby, for example:
Copy codeThe Code is as follows:
Rvm install ruby-1.8.7 -- head -- docs
-- Docs automatically generates documents after compilation and installation, and -- head is the latest version.
Delete a specific version of ruby and delete both the document and gems. Then:
Copy codeThe Code is as follows:
Rvm remove ruby-1.8.7 -- docs -- gems
Select version:
Copy codeThe Code is as follows:
Rvm use ruby-1.8.7 -- default
Query the current version:
Copy codeThe Code is as follows:
Rvm info
List versions:
Copy codeThe Code is as follows:
Rvm list
In addition to managing different ruby versions, rvm can also create different gemsets for each ruby version so that different Ruby applications can use their own Gem sets independently. For example, when using a ruby-1.9.2-p290, I need to build two rails projects, one using rails-3.0 and the other using rails-3.1.0, we can create two gemsets, install the corresponding rails version and other required gems in each gemset:
Copy codeThe Code is as follows:
Rvm gemset create rails-3.0 # create a gemset named rails-3.0
Rvm 1.9.2-p290@rails-3.0 # Use ruby-1.9.2-p290 and use rails-3.0 gemset
Gem install rails-v 3.0 # install rails 3.0 under rails-3.0 gemset
Rvm gemset create rails-3.1.0 # create a gemset named rails-3.1.0
Rvm 1.9.2-p290@rails-3.1.0 # Use ruby-1.9.2-p290 and use rails-3.1.0 gemset
Gem install rails-v 3.1.0 # install rails 3.1.0 under rails-3.0 gemset
More commands, access http://rvm.beginrescueend.com/rvm/