Last active
August 26, 2021 17:57
-
-
Save jll90/d73b6608805ed202969093bdab2907ef to your computer and use it in GitHub Desktop.
Update ruby version with rbenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This command lists all the ruby versions available for install. Make sure the ruby version you want to install is shown on the list | |
#In this case we will be looking to install 2.3.1 | |
rbenv install --list | |
#In case the ruby version (2.3.1) you want to install is not on the list, you will have to update both the rbenv | |
#and the ruby_build/plugin repositories | |
#Run the following two commands to update the corresponding git repositories (assuming both are installed inside your home folder) | |
cd ~/.rbenv; git pull; | |
cd plugins/ruby_build; git pull; | |
#List all the ruby versions to install, and make sure 2.3.1 is listed toward the beginning, above the jruby versions | |
rbenv install --list | |
#Install ruby 2.3.1 (this command will build ruby from scratch, so don't worry if it takes about five mins or longer) | |
rbenv install 2.3.1 | |
#When the above command is finished running, update the ruby version on your system to 2.3.1 and rehash. | |
rbenv global 2.3.1; rbenv rehash; | |
#Install bundler, which will be useful to update the gems in your Gemfile. | |
gem install bundle | |
####Only for RoR users#### | |
#Now you can go to the folder of your RoR project, and run bundle update. This will install all the dependencies with the new version of ruby. | |
#Note: There are some gems that you may have to install manually (with the gem install command). | |
bundle update | |
#Fire up your rails server and make sure everything is working as it should. | |
rails s | |
#If you are satisfied with the installation process, you can remove older versions of ruby using rbenv. In this case we will be | |
#uninstalling version 2.2.2. | |
rbenv uninstall 2.2.2; rbenv rehash; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment