The last gotcha that I'll point out is that you must indicate "ruby" when you run ruby-install, for example notice the error that I get when I run ruby-install 2.5.1 rather than ruby-install ruby 2.5.1ĭespite these peculiarities I find ruby-install a great tool to get my environment ready since I usually know what version of Ruby I am after. > Successfully installed ruby 2.5.1 into /Users/hector/.rubies/ruby-2.5.1Įven more puzzling is that even after downloading and installing Ruby 2.5.1 on my machine ruby-install will not show that it is available when I run ruby-install without arguments. > Installing dependencies for ruby 2.5.1. > Installing ruby 2.5.1 into /Users/hector/.rubies/ruby-2.5.1. You can request to install a newer version of Ruby if you know there is one available, for example I can issue ruby-install ruby 2.5.1 and it will install this version. Notice that there is no mention whatsoever of version 2.5.1. is now available at the web site this is what ruby-install shows on my machine: One thing that still confuses me with ruby-install is that it does not keep a list of newer versions of Ruby available to download and install. The rest of this post are a few notes on things that I've learned about ruby-install and chruby that were not obvious to me when I first started using them. I do not use this script, I prefer to manually issue a chruby command when I want to switch versions.Īnd that's pretty much all I need to setup my Ruby environment on a Mac. Source /usr/local/opt/chruby/share/chruby/chruby.shĬhruby also provides another script ( auto.sh) to automatically switch the version of Ruby as you cd into a specific project. bashrc file to automatically select Ruby 2.3.5 on my machine as the default Ruby. You can also use ruby-install -latest to install the latest version of Ruby available.Ĭhruby provides a script that you can add to your Bash init script to let you change to a specific version of Ruby installed on your machine and configure the environment to point to the correct locations for that Ruby version by setting your PATH, GEM_HOME, and GEM_PATH environment variables. Then I use ruby-install to install a particular version of Ruby, for example to install version 2.3.5 I use: First install ruby-install and chruby via Homebrew: In the end I found the combination of chruby and ruby-install the best for my needs, in large due to their minimalist approach.īelow are the instructions that I follow on a brand new Mac to install specific versions of Ruby and switch among them. Among the options that I tried were RVM, rbenv, and chruby. There are many tools to install and manage multiple versions of Ruby on a Mac. As my needs evolved I needed to have more than one version of Ruby installed on my machine to work on different projects that use specific versions of Ruby. Initially I was comfortable with the version of Ruby that comes installed on OS X by default or using the installer available at to install the latest version. When I started writing code on Ruby I learned there were many ways to download and install Ruby on a Mac. Installing Ruby with ruby-install and chruby
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |