see all versions of ruby download How to Manage Multiple Versions of Ruby on Windows. I had recently started work on a Rails project and was setting up my local dev environment which I wanted to make it as similar as possible to the environment on the server I will deploy to. The remote server currently runs Ruby 1.9.2 and Rails 3.x, so this is what I installed on my local machine. Whilst ensuring that everything worked as expected, I noticed was that WEBrick was very slow to boot. However, as this only needs to be done once (or occasionally twice) per session, I didn’t think much more of it. I then started coding, wrote some simple tests then ran test from the console. And waited, and waited, and waited… My minimal set of tests took over one and a half minutes to run. WTF. This was something that would seriously slow me down. I did some Googling and found out that I wasn’t the only one who was having issues with Rails 3 and Ruby 1.9.2. I read through a couple of questions on StackOverflow and found that one proposed solution was to upgrade to 1.9.3. Hmmm… I wanted to keep Ruby 1.9.2 installed, but needed a way to speed things up, so I started looking for ways to manage multiple Ruby versions on Windows (yes, I know, Windoof, but just remember that you cannot play Skyrim on Linux without performing a backwards somersault through your own sphincter). That’s when I discovered pik. Installing pik. pik bills itself as a tool to manage multiple versions of Ruby on Windows which can be used from the Windows command line (cmd.exe), Windows PowerShell, or Git . It sounded ideal for the job. In order to install pik you need a working version of Ruby. No problemo, I had already installed 1.9.2 using the mighty RubyInstaller. After that, as you can install pik via , it’s a matter of opening a command prompt and typing: If the gem installs successfully, you’ll see a message telling you to use the pik_install script to install the pik executable. You need to install it somewhere that’s located in your PATH , but not your ruby/bin directory. I did this (taking care with the backslash): As C:/pik isn’t in my PATH , I had to add it manually and restart the PC. Here’s a brief tutorial on how to do that (alter your PATH variable, not restart the PC). So following the reboot, it was time to install Ruby 1.9.3. I opened a command prompt and typed: Download Ruby. Here you can get the latest Ruby distributions in your favorite flavor. The current stable version is 3.0.2. Please be sure to read Ruby’s License. Ways of Installing Ruby. We have several tools on each major platform to install Ruby: On Linux/UNIX, you can use the package management system of your distribution or third-party tools (rbenv and RVM). On macOS machines, you can use third-party tools (rbenv and RVM). On Windows machines, you can use RubyInstaller. See the Installation page for details on using package management systems or third-party tools. Of course, you can also install Ruby from source on all major platforms. Compiling Ruby — Source Code. Installing from the source code is a great solution for when you are comfortable enough with your platform and perhaps need specific settings for your environment. It’s also a good solution in the event that there are no other premade packages for your platform. See the Installation page for details on building Ruby from source. If you have an issue compiling Ruby, consider using one of the third party tools mentioned above. They may help you. Stable releases: sha256: 5085dee0ad9f06996a8acec7ebea4a8735e6fac22f22e2d98c3f2bc3bef7e6f1 sha256: 3043099089608859fc8cce7f9fdccaa1f53a462457e3838ec3b25a7d609fbc5b sha256: 1807b78577bc08596a390e8a41aede37b8512190e05c133b17d0501791a8ca6d sha256: f5894e05f532b748c3347894a5efa42066fd11cc8d261d4d9788ff71da00be68 : This is a tarball of the latest snapshot of the current ruby_3_0 branch. : This is a tarball of the latest snapshot of the current ruby_2_7 branch. : This is a tarball of the latest snapshot of the current ruby_2_6 branch. : This is a tarball of whatever is in Git, made nightly. This may contain bugs or other issues, use at your own risk! For more information about specific releases, particularly older releases or previews, see the Releases page. Information about the current maintenance status of the various Ruby branches can be found on the Branches page. For information about the Ruby Subversion and Git repositories, see our Ruby Core page. The Ruby source is available from a worldwide set of Mirror Sites. Please try to use a mirror that is near you. Ruby on Windows Guides. Up to now we were managing multiple versions of Ruby through ConEmu tasks. Even though we can use different Ruby versions this way, such approach has few drawbacks. Testing scripts or running existing applications that relly on specific Ruby version require opening new or changing to tab that already has target Ruby activated. Adding new Ruby version is somewhat complex and soon we might finish with too many different tabs in ConEmu so it would be hard to remember which tab corresponds to particular Ruby version. Especially if we decide to install other Rubies besides MRI, like JRuby or IronRuby. At the moment we have two versions of Ruby on our system. The first one is official 2.2.1-p85 and the second one is the latest development version. Since we have used installer for the 2.2.1 and have chosen to add it to the path, in each Command Prompt we open it will be the only one available unless we add the path to the development version to the system path. So we have to choose either to use Ruby in ConEmu's tabs or to constantly alter system path in order to change Ruby version we work with. This certainly is not the most comfortable way and, fortunately, there is a much better solution. Uru is new, lightweight, portable which can be used to easily switch Ruby versions in the current Command Prompt. In order to install it you have to download archive with latest version from Bitbucket and unpack it in some folder that is in the PATH. In order to keep things isolated let's create new directory C:\tools and add it to the path as is explained in the first chapter - Windows Command Line. Open command prompt, go to target directory and execute following command: This will "install" Uru by creating two scipts in the same folder: uru.bat and uru.ps1 . Starting Uru without any option will display help screen with all available commands: If you now check which Ruby versions are registered with Uru you will see that it still doesn't know anything about existing Rubies on our system. As you can see from the help screen Uru has admin command which is used to administer installation. Executing following command will display information about available admin subcommands. So in order to register Ruby version with Uru we have to execute uru admin add with a directory of Ruby's bin folder as an argument. Let's register our first Ruby with Uru: By executing same command but this time with directory where our current development Ruby version is we will register second Ruby version. Listing Rubies known to Uru will now show both our versions. Now we can easily switch currently used Ruby version. Just to be sure check which Ruby is active now. Similarly we can switch Ruby to latest development version: But how we will switch Ruby version if we have multiple patchlevels of same version installed (same build numbers i.e 2.2.1 with different number after 'p', i.e. p85)? If we invoke Uru with only base version info and we have multiple patchlevels installed we will get following output: You can see that Uru is smart enough to display all versions that match version information given in the switch command. Now you can easily choose version or quit by entering 0. If you want to avoid this additional step you can use version tag which Uru displays after installing new version, in output of uru ls command or in the menu that appears if conflicting versions are found when version switch command is executed. In the above example these tags are 221p85 and 221p95. So executing: will immediately change active Ruby version. There's much more you can do with Uru. Define gemsets on project level, change Ruby tag value, etc. but that's beyond the scope of this book. Another Ruby version manager available on Windows is Pik. Pik is quite old and not maintained any more but still can be used for managing installed Rubies. Since Pik is quite old and all samples are written for old Rubies and are not updated for newest versions. Pik is implemented as Ruby gem so it is installed as any other Ruby gem. Open new Command Prompt window (not ConEmu) and execute following command: Command is executed in the new Command Prompt where the only Ruby available, at the moment, is 2.2.1, therefore gem will be installed in it. Let's check that: As you can see Pik is available in the list of gems currently available to the default Ruby. If you wonder where other gems come from when we didn't install them they are bundled with Ruby and are available with Ruby installation. It is time to finalize Pik installation. Comments displayed after gem is installed are self-explanatory but let's analyze them. We are not upgrading Pik so we can skip the first one. The second one states that we must use pik_install command in order to install Pik, and we should pass it, as argument, some directory that is in the path. It is recommended to avoid our ruby\bin directory. Currently our path contains directories added during Windows installation, directory where Git is installed and, finally, bin directory of our Ruby 2.2.1 version. Since I like to keep things clear we will create new directory which we will use when we launch pik_install command. We'll follow Pik's suggestion and install it in previously created C:\tools directory. As a good behaved tool, Pik displayed everything it did during installation. First it created directory where it installed it's files, C:\tools in our case. If directory already exists Pik will do nothing. Next, it creates .pik directory in C:\Users\bosko . But why does Pik chose this directory? On the Unix-like systems all user specific files and directories are kept in user's home directory which is usually located at the /home/ path and this value is stored in HOME system variable. On Windows, value that is used is stored in the USERPROFILE variable and on my system its value is C:\Users\bosko . Pik stores its data within .pik directory in the user's home folder. That it a reason why it created .pik folder in it. Further, it installed necessary scripts in the C:\tools folder by copying them from gem folder. At the end, Pik created .pikrc file in the .pik folder. Don't be surprised by the name of the folder and the path. Naming convention on Unix-like systems is to hide them by prefixing names with a dot. Actually files and directories which have names that start with a dot are not actually hidden but are not displayed in any tool unless specifically requested. Pik follows this convention so it uses .pik and .pikrc for names of its folder and file within it. Notice last comment printed out by pik_install script. It tells us that if we want to use Pik from Git bash shell we should add line: /.bashrc file . Again tilda character is used on Unix-like systems to denote user's home folder. As you might already guess it is C:\Users\bosko on my system. Let's retain for a while on the .pikrc file. In the version 0.2.8 it contains following code: The first line is the shebang line we mentioned earlier. Value /bin/sh means that the rest of the script should be executed in the shell. After that, there is a definition for pik_path variable and then a code that looks like, and is, function definition. As comment printed out at the end of execution of pik_install script indicates, that this script is used for Git bash shell. Since Git uses Linux-like shell called Bash, it inherits almost all functionalities from Linux system. In Windows Command Prompt invoking pik command means executing pik.bat , batch file, stored in the C:\tools directory. On the other hand Git bash shell doesn't know how to start pik command. Open new ConEmu window and type in the Git bash tab: Therefore in order to use Pik in this shell we must execute it in such a way that pik function becomes available in it. You can do it by executing following statement: which tells Bash shell to apply changes from .pikrc configuration file. After that you can try Pik in the Git's Bash shell too: If you do not want to “source” this configuration file every time you open Git Bash you should create .bashrc file in your home folder and put. in it. Go ahead and try it. Close current Git tab in ConEmu, create .bashrc file and then open Git tab again. You will see that Pik command is available. Up to now we haven't actually tried Pik at all. We have only checked its availability in the Git Bash shell and its version. It is time to execute Pik for the first time: Amazing! Pik somehow found our installed Ruby and added it to its list of available Rubies. The question is how did Pik know what Ruby we have. The answer is, again, Windows registry. If you open Registry Editor and navigate to HKEY_CURRENT_USER\Software\RubyInstaller key you will see that it has MRI sub-key, and that's the place where it finds all necessary data about installed Ruby versions. If you are curious what data is stored there click on the 2.2.1 sub-key within MRI and you will see that it holds information about platform Ruby is built on, installation date, full path to the directory where Ruby is installed as well as a patch level. And that's all Pik has to know to add Ruby version to itself. Now go back to .pik folder in your home directory. You will see additional file created there, named config.yml . Extension .yml denotes it is YAML file. YAML (YAML Ain't Markup Language) is common format for serializing data in Ruby world. We will not dwell on it. If you are not already familiar with YAML you can check the official YAML Web Site. Let's go further and open config.yml in your favorite editor. As you can see Pik has stored all data it needs about our Ruby in that configuration file. We should start exploring Pik features at this point. Fire up ConEmu and in the default tab check the list of all Ruby versions Pik is aware of by issuing pik list or pik ls command: As expected, at the moment, Pik is aware only of our installed Ruby 2.2.1 version and it is marked as a default one, in the list that is printed out, by the asterisk (*) sign at the beginning of the line. More then just listing installed Ruby versions, Pik is capable of showing all Ruby versions that can be installed through it. Omitting DevKit for the moment we can see that Pik can install various versions of IronRuby, JRuby and MRI. We'll use this Pik's feature and install IronRuby. This version is not so important for usage throughout the book, but is installed just to show one of many Pik's features. Before we start IronRuby installation we'll configure Pik to install new Ruby versions where we want to – in C:\Ruby . Now we are ready to start IronRuby installation. This is simple and elegant way to install additional Ruby versions on your Windows system. Checking available Rubies now gives: You must be aware of the fact that installing Rubies through Pik doesn't run full installer, if it is available. Rather Pik downloads Zip or 7Zip archives, unpacks them and adds to its configuration file. This means that various configuration options that exist in installers like altering system path, files associations, menu shortcuts, etc. will not be set. Additionally Pik has command for displaying more information about Ruby setup that is active in the current shell – pik info. Output of Pik's info command shows active interpreter version, full path where existing Ruby gems are and future ones will be installed, path to Ruby binaries, environment variables and file associations. Until now we have added two Ruby versions to Pik. First was added automatically when we first ran Pik and the second one was installed through Pik itself. In the chapter Building Ruby we have built latest development version, copied it to C:\Ruby\22dev directory, but Pik is not aware of it. We will use new Pik command to add this version. Logically command is called add and it accepts path to the directory where ruby.exe is located. In a similar way we can add any Ruby version available on the system that is not installed through RubyInstaller installer. If we download any of Ruby 1.8 archives from RubyInstaller's download page all we have to do is to unpack archive to some directory and use pik add command to add it to the list of versions that Pik can handle. Installing Ruby 1.8.7p330 is left for your exercise. At the beginning of this chapter we said Pik's main purpose is to manage various Ruby versions. At any time you can change active Ruby version using Pik's switch command. See all versions of ruby download. This is Ruby, a natural, flexible, object-oriented programming language created by the Japanese Yukihiro 'Matz' Matsumoto in 1993. Its author took parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) and used them to create something new. Currently, it's one of the most prolific languages in use, due to its expansion through web programming. The installation packet includes the latest version of Ruby, the code editor SciTE, and the compiler FreeRide. This last element is very complete: it enables you to write applications in Ruby, search for errors in the source code, and consult the documentation of its syntax. Installing Ruby. With package managers or third-party tools, you have plenty of options to install and manage Ruby. You may already have Ruby installed on your computer. You can check inside a terminal emulator by typing: This should output some information on the installed Ruby version. Choose Your Installation Method. There are several ways to install Ruby: On a UNIX-like , using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. Installers can be used to install a specific or multiple Ruby versions. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Finally, you can also build Ruby from source . On Windows 10, you can also use the Windows Subsystem for Linux to install one of the supported Linux distributions and use any of the installation methods available on that system. Here are available installation methods: Package Management Systems. If you cannot compile your own Ruby, and you do not want to use a third-party tool, you can use your system’s package manager to install Ruby. Some members of the Ruby community feel that you should avoid package managers to install Ruby and that you should use dedicated tools instead. It is possible that major package managers will install older Ruby versions instead of the latest release. To use the latest Ruby release, check that the package name matches its version number. Or use a dedicated installer. apt (Debian or Ubuntu) Debian GNU/Linux and Ubuntu use the apt package manager. You can use it like this: yum (CentOS, Fedora, or RHEL) CentOS, Fedora, and RHEL use the yum package manager. You can use it like this: The installed version is typically the latest version of Ruby available at the release time of the specific distribution version. snap (Ubuntu or other Linux distributions) Snap is a package manager developed by Canonical. It is available out-of-the-box on Ubuntu, but snap also works on many other Linux distributions. You can use it like this: We have several channels per Ruby minor series. For instance, the following commands switch to Ruby 2.3: portage (Gentoo) Gentoo uses the portage package manager. To install a specific version, set RUBY_TARGETS in your make.conf . See the Gentoo Ruby Project website for details. pacman (Arch Linux) Arch Linux uses a package manager named pacman. To get Ruby, just do this: This should install the latest stable Ruby version. Homebrew (macOS) Ruby versions 2.0 and above are included by default in macOS releases since at least El Capitan (10.11). Homebrew is a commonly used package manager on macOS. Installing Ruby using Homebrew is easy: This should install the latest Ruby version. FreeBSD. FreeBSD offers both pre-packaged and source-based methods to install Ruby. Prebuilt packages can be installed via the pkg tool: A source-based method can be used to install Ruby using the Ports Collection. This is useful if you want to customize the build configuration options. More information about Ruby and its surrounding ecosystem on FreeBSD can be found on the FreeBSD Ruby Project website. OpenBSD. OpenBSD as well as its distribution adJ has packages for the three major versions of Ruby. The following command allows you to see the available versions and to install one: You can install multiple major versions side by side, because their binaries have different names (e.g. ruby27 , ruby26 ). The HEAD branch of the OpenBSD ports collection might have the most recent version of Ruby for this platform some days after it is released, see directory lang/ruby in the most recent ports collection. Ruby on OpenIndiana. To install Ruby on OpenIndiana, please use the Image Packaging System (IPS) client. This will install the Ruby binaries and RubyGems directly from the OpenIndiana repositories. It’s easy: However, the third-party tools might be a good way to obtain the latest version of Ruby. Other Distributions. On other systems, you can search the package repository of your Linux distribution’s manager for Ruby. Alternatively, you can use a third-party installer. Installers. If the version of Ruby provided by your system or package manager is out of date, a newer one can be installed using a third-party installer. Some installers allow you to install multiple versions on the same system; associated managers can help to switch between the different Rubies. If you are planning to use RVM as a version manager you don’t need a separate installer, it comes with its own. ruby-build. ruby-build is a plugin for rbenv that allows you to compile and install different versions of Ruby. ruby-build can also be used as a standalone program without rbenv. It is available for macOS, Linux, and other UNIX-like operating systems. ruby-install. ruby-install allows you to compile and install different versions of Ruby into arbitrary directories. chruby is a complimentary tool used to switch between Ruby versions. It is available for macOS, Linux, and other UNIX-like operating systems. RubyInstaller. On Windows, RubyInstaller gives you everything you need to set up a full Ruby development environment. Just download it, run it, and you are done! Ruby Stack. If you are installing Ruby in order to use , you can use the following installer: provides a complete development environment for Rails. It supports macOS, Linux, Windows, virtual machines, and cloud images. Managers. Many Rubyists use Ruby managers to manage multiple Rubies. They allow easy or even automatic switching between Ruby versions depending on the project and other advantages but are not officially supported. You can however find support within their respective communities. asdf-vm. asdf-vm is an extendable version manager that can manage multiple language runtime versions on a per-project basis. You will need the asdf-ruby plugin (which in turn uses ruby-build) to install Ruby. chruby. chruby allows you to switch between multiple Rubies. It can manage Rubies installed by ruby-install or even built from source. rbenv. rbenv allows you to manage multiple installations of Ruby. While it can’t install Ruby by default, its ruby-build plugin can. Both tools are available for macOS, Linux, or other UNIX-like operating systems. RVM (“Ruby Version Manager”) RVM allows you to install and manage multiple installations of Ruby on your system. It can also manage different gemsets. It is available for macOS, Linux, or other UNIX-like operating systems. Uru is a lightweight, multi-platform command line tool that helps you to use multiple Rubies on macOS, Linux, or Windows systems. Building from Source. Of course, you can install Ruby from source. Download and unpack a tarball, then just do this: By default, this will install Ruby into /usr/local . To change, pass the --prefix=DIR option to the ./configure script. You can find more information about building from source in the Ruby README file. Using the third-party tools or package managers might be a better idea, though, because the installed Ruby won’t be managed by any tools.