In this post, I would like to share how we can easily install multiple version of Rails in mac and isolating one from another
so, that you can build two Rails applications at a time in your system which uses different Rails versions.
Step1: If you don’t have rvm already installed in your mac, Install rvm in mac for easy version managing. To install rvm, use the
following command$ \curl -sSL https://get.rvm.io | bash -s stable
Step2: Once rvm is installed, you can use rvm Gemsets for maintaing multiple Rails versions.In order to view the already
available gem sets in your system type$rvm gemset list
Step3: Now create a new gem set. In order to create a new gem set, type
$rvm gemset create gemsetname
Step4: Now use this gem set
$rvm gemset use gemsetname
Step5: Now you can install the Rails version that you want for creating the New project by typing
$gem install rails -v railsversion
Step6: Once the rails is installed. Now your gem set uses the recently installed Rails, whenever you use that particular gem set.
Now you can view the list of available gem sets by typing
$rvm gemset list
Step7: Now your system uses the recently created gem set for selecting Rails version during New Project creation. You can use any
of the Ruby Interpreter version with this gem set by typing
$rvm use rubyversion @gemsetname
You can also specify the *default* gem set for the given Ruby interpreter by typing
$rvm use rubyversion @gemsetname —default
Now your New project uses Rails railsversion and Ruby rubyversion for it’s Interpretation.
Step8: Now once you have finished your job in the New Project, you can easily switch back to earlier gem set by typing
$rvm use earliergemsetname
OR, You can create one more gem set following the same above procedure.
Conclusion: Using gem sets you can easily create as many gem sets as you want and easily switch between them.