How to Install Ruby on Windows 11
Ruby is a dynamic, object-oriented, general-purpose programming language that features automatic memory management and supports multiple programming paradigms, including functional, procedural, and object-oriented programming. It has a simple and expressive syntax allows developers to write code quickly and efficiently.
Ruby is mainly used for web development, particularly in developing server-side applications and frameworks like Ruby on Rails. It can also create desktop applications, mobile apps, and scripting tasks. Ruby’s popularity has grown due to its ease of use, flexibility, and availability of many libraries and frameworks. It is often used in startups and agile development environments, where rapid prototyping and iteration are critical.
In this tutorial, we will learn how to set up the latest version of Ruby interpreter on Windows 11 using various methods.
Let us dive in.
Requirements
- Windows 10 and above
- Administrative permissions
- Access to Command Prompt or PowerShell
- A working Network Connection.
Method 1 - Install Ruby Using RubyInstaller
RubyInstaller is a software package for Microsoft Windows that provides a self-contained installation of the Ruby programming language, including the Ruby language interpreter, development tools, and libraries. It is designed to make it easy for developers to install Ruby on their Windows machines and develop Ruby applications quickly.
The RubyInstaller includes a precompiled version of the Ruby interpreter and many libraries and tools commonly used in Ruby development, such as the RubyGems package manager and the Bundler dependency management tool. The installer also includes many development tools, such as the Ruby Development Kit (DevKit), which provides development tools and libraries that allow developers to build native C/C++ extensions for Ruby.
Step 1 - Download the RubyInstaller
Open your browser and head over to the RubyInstaller downloads page provided in the link below:
https://rubyinstaller.org/downloads/
You will find two options on the downloads page: one with DevKit and the other without a DevKit.
If you want to use the system for developing software, ensure to include the Ruby version with a DevKit otherwise, if you are only interested in the Ruby interpreter, select the one without.
Step 2 - Launch the Installer
Once the download is complete, double-click to open the installer program. This may prompt you whether you wish to install Ruby for you or all accounts in the system.
In the next step, accept the License and click Next to proceed.
Next, configure the destination directory. Once satisfied with the configuration options, click Install to setup Ruby on your machine.
In the Components page, choose the target components you wish to install or skip.
Once the installation is complete, the installer may require you to install the MSYS2 Package.
Select the option and click Finish.
In the Prompt window, choose the MSYS2 Base Installation to configure and set up MSYS2 on your system.
What is MSYS2?
MSYS2 is a collection of software packages for Microsoft Windows that provides a Unix-like environment for the development and execution of command-line applications and scripts. It is designed to provide a full-featured POSIX environment on Windows, including a bash shell, GNU utilities, and other development tools commonly found on Unix-like operating systems.
Wait for the process to complete, and you should set up the Ruby interpreter on your system.
Method 2 - Install Ruby Using WinGet.
The second method we can use to install Ruby on Windows is using the Windows Package Manager, also known as WinGet
.
If you do not have WinGet
installed on your machine, you can check the resource below:
https://www.geekbits.io/how-to-install-windows-package-manager/
However, if you have WinGet
setup on your machine, open the command prompt as administrator and run the command:
winget install -e --id RubyInstallerTeam.Ruby.2.7
And boom, the command above should download and install the Ruby interpreter on your Windows machine.
Method 3 - Install Ruby Using Scoop
Scoop is the third method we can use to install Ruby on a Windows machine. Scoop is a feature-rich package manager for Windows.
You can learn how to install Scoop on your Windows system in the article below:
https://www.geekbits.io/how-to-install-scoop-on-windows
Once Scoop is installed, open the command prompt as administrator and update scoop as:
scoop update
Next, add the main bucket with the command:
scoop bucket add main
Finally, install Ruby with the command:
scoop install ruby
Verify Ruby is Installed
Once you have installed Ruby using either of the abovementioned methods, it is time to verify that Ruby is working.
Open the command prompt and run the command:
irb --version
The command above should return the installed version of the Ruby interpreter as shown in the sample output above.
irb 1.6.2 (2022-12-13)
And there you have it, you have successfully installed Ruby on a Windows system.
Conclusion
In conclusion, installing Ruby on your Windows computer is a straightforward process that can be done using various tools such as RubyInstaller, WinGet
, and Scoop.
RubyInstaller is the most popular and easiest way to install Ruby on Windows. However, WinGet
and Scoop offer more advanced features like package management and easy updates. Regardless of your chosen method, once installed, Ruby provides a powerful and versatile programming language that can be used for web development, scripting, and many other applications. Happy coding!
We hope you enjoyed this tutorial. Leave us a comment below and show your love.