Ruby 3.3 on Windows: Day 0 - install and Hello World

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write (from the Ruby web site). On Christmas Day 2023, the core team released version 3.3 with major improvements and new features included. Now that RubyInstaller 3.3.0-1 has been released and is available for all to try, it’s a good time to set it up on Windows and try the features of Ruby 3.3. This post will help you get started with Ruby 3.3 on Windows, and covers the basics of installation. This post is along the same lines as the JRuby Day 0 post from earlier.

Note: This post was written for Ruby 3.3.0 but should work for other versions also.

There are a few ways to run Ruby on Windows (RubyInstaller, Windows Subsystem for Linux, Docker, etc.) but we will follow the simplest and most native way – to use the RubyInstaller.

Ok, so it’s Day 0 – the day we set up Ruby on Windows and run a simple script. We will do the following:

  • Download and install Ruby 3.3 on Windows
  • Run a Ruby script
  • Install a gem
  • Set up pik for multiple Ruby versions

Before we get started

A full Ruby installation, as we intend to do, will take upwards of approximately 900MB of disk space. I recommend that you set the folder to be compressed automatically by Windows so that it saves you space. This becomes important especially on SSDs where the space might be limited to start with anyway.

A quick note on the path: I would strongly recommend that you install Ruby to a directory that has no spaces in the path. Some of the tools have problems compiling extensions when there are spaces in the path. So, it’s much better to install to C:\Ruby33-x64 or C:\Users\JSmith\Ruby33-x64 rather than C:\Users\John Smith\Ruby33-x64.

You can do this step after you finish the installation but it takes much longer than doing it now when the folder is empty so that Windows will automatically compress the files on the fly as they get written to the directory as part of the installation.

So, this is what you need to do:

  • In C Drive, create a folder called Ruby32-x64 – this is where we will install Ruby 3.2
  • In Explorer then, right click on the new folder and click Properties which brings up a menu like the one you see below.
  • Click on Advanced… which brings up the ‘Advanced Attributes’ menu.
  • Check the setting for ‘Compress contents to save disk space’ – this will ensure that the file in this folder are compressed on the disk and will save you a lot of space on the installation. At the end of the installation, we will see how much!

Uninstalling an Older Version (optional)

Do you want to uninstall an older Ruby version? There are instructions on this page should you want to. If you need to run multiple versions of Ruby on the same PC, it’s not a problem if you use something like pik that we also discuss below.

Download and install Ruby on Windows

Head on over to the RubyInstaller Downloads site and grab the package for rubyinstaller-devkit-3.3.0-1-x64 (it’s approximately 125MB). In general, you would want to get the 64-bit package (x64) but in case you want the 32-bit, you should get the x86 package listed below it. For widest compatibility with all types of gems including C native extensions, you should get the ‘Ruby+Devkit’ package though if you only want the Ruby runtime, the package without Devkit (listed further down) would also work. I would recommend getting the package with Devkit. The screenshot below shows the different items listed on the page.

Run the dowloaded file. You may be presented with a screen asking if you intend to install this software.

Expand the details by clicking on [More Info] and you should see a screen like the one below. Click on [Run Anyway] to proceed to the installation.

The next step asks if you want to install the software for all users or only for the current user.

This is new since RubyInstaller for Ruby 3.2. For now, we will follow the recommended path to install for the current user but feel free to try it out for all users and if you find issues, feel free to report your observations and re-open this issue

Read and accept the license and click Next.

This takes us to the next page and asks us for the path, whether it should add Ruby to our system path and if it should associate Ruby files with this installation. I personally prefer to uncheck the second option so that I have more choice in which Ruby version runs the script. Ensure that the path shown matches the folder that we had set to be compressed. Adding it to the system path has the effect that when you open a new command window, it will directly use the newer version. If you don’t really care which Ruby version you are using, then it may be better to let the installer add it to your path so that by default, you continue to use the latest version.

Since we created the folder before the installation (to set the attribute for compressing it), the Ruby installer will warn you that the folder already exists and will ask to confirm that it is OK to proceed. Our folder is empty and it is OK to go ahead! Click Yes.

In general, it is a good idea to install all these components since it makes the documentation available to you offline, and also prepares the MSYS2 development toolchain which is needed for compiling native gems. Select everything and click Next.

You will next see a lot of files being installed – just let that go ahead. Depending on your computer, this will take up to a few minutes.

This finally comes to the screen that tells you that the main installation is done and the next step is to move on to the MSYS2 Setup. Check the option to ‘Run ridk install’ so that it can proceed and click ‘Finish’. Note also the important links that are shown here.

This then brings us the Command Line based installation for the MSYS2 toolchain. I would recommend that you either choose 1,2,3 or just use the default 1,3 at this stage.

Eventually, it comes to the prompt below and just press ENTER at this stage again.

The installer will exit now and we are good to get started.

Is it all there?

Since the installation is all done, you should be able to open a new Command Line Prompt and type ruby -v to see it run.

So, yes, we have Ruby 3.3.0 on our computer now. We also installed everything to D:\Ruby33-x64 and can go and take a look at the files and folders there. Talking about that folder, you can now right click on that folder and check properties again. The exact numbers might be different, but you will likely see something like this. On my computer, the actual file sizes are approximately 931MB but on disk, it’s only taking 559MB – so, I saved almost 370MB by setting the folder to be compressed. Also, since this is applied to all the files and folders, as you install more gems, those will also be automatically compressed and will continue to take up lesser disk space.

Hello, World!

Let’s write the simplest Hello World program and save it to a file called hello.rb.

puts "Hello from Ruby #{RUBY_VERSION}"

Then, you can run this by doing:

$ ruby hello.rb

Using Interactive Ruby

Next, you can start up Interactive Ruby and try something in it to see it work.

$ irb
irb(main):001> puts RUBY_VERSION
=> nil
irb(main):002> 3.times {puts 'welcome'}
=> 3
irb(main):003> puts "Rocking it on #{RUBY_VERSION}"
Rocking it on 3.3.0
=> nil
irb(main):004> exit

Working with gems

All Ruby programmers will install and use gems. In Ruby, we use gem install [gem_name] which is shortcut for running the system command gem (which could be done as ruby -S gem install [gem_name]).

You can check the version of gem as below.

$ gem -v

Gems already installed

A lot of gems are installed as part of the Ruby installation. Do the following to see the list. It should show you something like the list below.

$ gem list

*** LOCAL GEMS ***

abbrev (default: 0.1.2)
base64 (default: 0.2.0)
benchmark (default: 0.3.0)
bigdecimal (default: 3.1.5)
bundler (default: 2.5.3)
cgi (default: 0.4.1)
csv (default: 3.2.8)
date (default: 3.3.4)
debug (1.9.1)
delegate (default: 0.3.1)
did_you_mean (default: 1.6.3)
digest (default: 3.1.1)
drb (default: 2.2.0)
english (default: 0.8.0)
erb (default: 4.0.3)
error_highlight (default: 0.6.0)
etc (default: 1.4.3)
fcntl (default: 1.1.0)
fiddle (default: 1.1.2)
fileutils (default: 1.7.2)
find (default: 0.2.0)
forwardable (default: 1.3.3)
getoptlong (default: 0.2.1)
io-console (default: 0.7.1)
io-nonblock (default: 0.3.0)
io-wait (default: 0.3.1)
ipaddr (default: 1.2.6)
irb (default: 1.11.0)
json (default: 2.7.1)
logger (default: 1.6.0)
matrix (0.4.2)
minitest (5.20.0)
mutex_m (default: 0.2.0)
net-ftp (0.3.3)
net-http (default: 0.4.0)
net-imap (0.4.9)
net-pop (0.1.2)
net-protocol (default: 0.2.2)
net-smtp (0.4.0)
nkf (default: 0.1.3)
observer (default: 0.1.2)
open-uri (default: 0.4.1)
open3 (default: 0.2.1)
openssl (default: 3.2.0)
optparse (default: 0.4.0)
ostruct (default: 0.6.0)
pathname (default: 0.3.0)
power_assert (2.0.3)
pp (default: 0.5.0)
prettyprint (default: 0.2.0)
prime (0.1.2)
prism (default: 0.19.0)
pstore (default: 0.1.3)
psych (default: 5.1.2)
racc (1.7.3)
rake (13.1.0)
rbs (3.4.0)
rdoc (default: 6.6.2)
readline (default: 0.0.4)
reline (default: 0.4.1)
resolv (default: 0.3.0)
resolv-replace (default: 0.1.1)
rexml (3.2.6)
rinda (default: 0.2.0)
rss (0.3.0)
ruby2_keywords (default: 0.0.5)
securerandom (default: 0.3.1)
set (default: 1.1.0)
shellwords (default: 0.2.0)
singleton (default: 0.2.0)
stringio (default: 3.1.0)
strscan (default: 3.0.7)
syntax_suggest (default: 2.0.0)
tempfile (default: 0.2.1)
test-unit (3.6.1)
time (default: 0.3.0)
timeout (default: 0.4.1)
tmpdir (default: 0.2.0)
tsort (default: 0.2.0)
typeprof (0.21.9)
un (default: 0.3.0)
uri (default: 0.13.0)
weakref (default: 0.1.3)
win32ole (default: 1.8.10)
yaml (default: 0.3.0)
zlib (default: 3.1.0)

You will note that importantly bundler is installed and you will often use that when you start working seriously with Ruby.

Installing a gem

Let’s install a gem into our new Ruby 3.3 install. You can skip this is you are not keen. For simplicity, let’s install sinatra which is a web development framework.

$ gem install sinatra
Fetching tilt-2.3.0.gem
Fetching mustermann-3.0.0.gem
Fetching rack-protection-3.1.0.gem
Fetching rack-2.2.8.gem
Fetching sinatra-3.1.0.gem
Successfully installed tilt-2.3.0
Successfully installed rack-2.2.8
Successfully installed rack-protection-3.1.0
Successfully installed mustermann-3.0.0
Successfully installed sinatra-3.1.0
Parsing documentation for tilt-2.3.0
Installing ri documentation for tilt-2.3.0
Parsing documentation for rack-2.2.8
Installing ri documentation for rack-2.2.8
Parsing documentation for rack-protection-3.1.0
Installing ri documentation for rack-protection-3.1.0
Parsing documentation for mustermann-3.0.0
Installing ri documentation for mustermann-3.0.0
Parsing documentation for sinatra-3.1.0
Installing ri documentation for sinatra-3.1.0
Done installing documentation for tilt, rack, rack-protection, mustermann, sinatra after 22 seconds
5 gems installed

So, we know how to install gems now. Let’s install a gem that is very helpful on Windows.

Installing pik when using multiple Ruby Installations

pik is a gem that allows you to switch between different Ruby installations on a Windows computer. Although it is no longer maintained according to the github page, I found that it still works fine for me. It also works with JRuby (not just Ruby) by updating the PATH and other variables.

Open a command prompt that has Ruby 3.3 on the path and do gem install pik

$ gem install pik
Fetching pik-0.2.8.gem


*  If you're upgrading from a version <= 0.1.1, you'll want to delete the pik.bat file
   from all of your ruby versions. Gem uninstall should do the trick.

*  Install pik to a location that's in your path, but someplace other than your ruby\bin dir
   If you're upgrading from a more recent version, pik_install will overwrite the older files as needed.


    >pik_install C:\tools

*  If this is a first-time install, add all the versions of ruby that you want to use with pik

    >pik add
    Adding:  186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]
     Located at:  c:/ruby/186-p368-mingw32/bin

    >pik add C:\ruby\IronRuby-091\bin
    Adding:  091: IronRuby on .NET
     Located at:  C:/ruby/IronRuby-091/bin

    >pik add C:\ruby\jruby-1.4.0RC1\bin
    Adding:  140: jruby 1.4.0RC1 (ruby 1.8.7 patchlevel 174) (2009-09-30 80c263b) (Java HotSpot(TM) Client VM 1.6.0_14) [x86-java]
     Located at:  C:/ruby/jruby-1.4.0RC1/bin


Successfully installed pik-0.2.8
Parsing documentation for pik-0.2.8
Installing ri documentation for pik-0.2.8
Done installing documentation for pik after 2 seconds
1 gem installed

The first time you ever use pik on a computer, you will need to install it to a folder that is on your PATH other than the bin folder of any Ruby installation. Two common options are to install it to c:\windows\System32 (you will need to use an adminstrator command prompt for that) or to create a folder such as c:\tools for dropping executables of this kind and adding that folder to your system path. If you need help with any of these steps, just ask below and I will add the information here. Whichever folder you choose, do as shown below (but replace ‘c:\tools’ with the actual directory)

>pik_install C:\tools

Next, you add the current Ruby that is on the path by doing pik add as below.

$ pik add
** Adding:  330: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x64-mingw-ucrt]
 Located at:  D:\Ruby33-x64\bin

Alternatively, you can add by using the full path to the Ruby installation bin folder as shown below.

$ pik add D:\Ruby33-x64\bin

Finally, to see all the Ruby installations that you have, just do pik list and you should get a list of Ruby versions that you have added. My list is shown below.

$ pik list
$ pik list
  187: ruby 1.8.7 (2013-06-27 patchlevel 374) [i386-mingw32]
  193: ruby 1.9.3p551 (2014-11-13) [i386-mingw32]
  224: ruby 2.2.4p230 (2015-12-16 revision 53155) [x64-mingw32]
  266: ruby 2.6.6p146 (2020-03-31 revision 67876) [x64-mingw32]
  274: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x64-mingw32]
  300: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
  311: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x64-mingw-ucrt]
  320: ruby 3.2.0 (2022-12-25 revision a528908271) [x64-mingw-ucrt]
* 330: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x64-mingw-ucrt]
  921: jruby (2.5.7) 2020-08-03 9a89c94bcc OpenJDK 64-Bit Server VM 25.265-b01 on 1.8.0_265-b01 +ji...
  928: jruby (2.5.8) 2021-06-08 d67cb7d6e0 OpenJDK 64-Bit Server VM 25.265-b01 on 1.8.0_265-b01 +ji...
  932: jruby (2.6.8) 2021-12-01 0b8223f905 OpenJDK 64-Bit Server VM 25.265-b01 on 1.8.0_265-b01 +jit...

You can switch between versions by doing something like pik 266 or pik 330 and so on – basically use the 3 digit code that it shows on the line at the start.

What’s next?

You’re ready to use Ruby 3.3 on Windows – enjoy!

Links and References

Here are the main links:

  • Ruby website:
  • RubyInstaller Website:
  • Download RubyInstaller for Windows:
  • RubyInstaller Google Group:
  • Wiki:

OK, so we have done enough for Day 0 – we know how to install Ruby, run a script, install gems directly and switch between different Ruby installations. We are ready for more! If you found this post useful or would like to add more thoughts, feel free to share the post (you can tag me as @onghu on Twitter or on Mastodon as ) or leave a comment below.

comments powered by Disqus