Overview
Whether you’re starting a new Ruby project, upgrading an existing one, or troubleshooting compatibility issues, knowing your Ruby version is essential. This guide will walk you through everything you need to know about checking Ruby version across different tools, platforms, and environments.
Introduction: What is Ruby?
Ruby is a dynamic, open-source programming language that’s all about simplicity and productivity. It’s got a clean, readable syntax that makes coding feel almost like writing plain English.
Whether you’re building web apps with Ruby on Rails, scripting automation tasks, or diving into data analysis, Ruby’s versatility makes it a favorite among developers. But to make the most of it, you need to know which version you’re running.
Checking Ruby version is a crucial step to ensure your projects run smoothly and stay compatible with the tools you’re using.
Why Checking Your Ruby Version Matters?
Before we dive into the how-to, let’s talk about why checking Ruby version is so important.
Ruby evolves constantly, with the newest version of Ruby (3.4.4 as of June 2025) bringing performance boosts and new features. However, not every gem or framework plays nicely with every Ruby version. Older projects might rely on specific versions, and mismatched versions can lead to errors that’ll have you pulling your hair out.
By knowing how to check version of Ruby, you can avoid compatibility headaches, ensure your dependencies work, and keep your development environment stable. Plus, it’s a quick way to confirm you’re using the newest version of Ruby for optimal performance.
How to Check Ruby Version
Let’s get to the good stuff: the various ways to check Ruby version. Whether you’re on a Mac, Linux, or Windows, these methods will help you figure out exactly what version you’re working with.
Checking Ruby Version in IRB
IRB, or Interactive Ruby, is a great place to start. It’s like a playground where you can run Ruby code directly. To check Ruby version in IRB:
- Open your terminal (on macOS, Linux, or Windows).
- Type irb and hit Enter to launch the IRB session.
- Once you’re in, type RUBY_VERSION and press Enter.
You’ll see something like "3.3.5", showing the exact Ruby version. This method is super straightforward and works across all platforms, including when you need to check Ruby version on Mac. It’s perfect for a quick peek without leaving the Ruby environment.
Checking Ruby Version From Command Line
The command line is probably the fastest way to check version of Ruby. Just open your terminal and type:
or
Hit Enter, and you’ll get output like, say for example, ruby 3.3.5 (2025-06-12 revision abc123) [x86_64-linux]. This method is universal, whether you’re checking Ruby version on Mac or any other system. It’s also handy when you want to confirm the version without diving into a coding session.
Checking Ruby Version in RVM
RVM (Ruby Version Manager) is a popular tool for managing multiple Ruby versions on one machine. If you’re using RVM, checking Ruby version is a breeze:
This command lists all installed Ruby versions, with an arrow (=>) pointing to the active one, like ruby-3.3.5 [x86_64]. If you just want the current version, run:
This will output something like ruby-3.3.5. RVM is great for developers juggling multiple projects with different Ruby versions, and this method ensures you know exactly which one is active.
Benefits of RVM:
- Install and switch between multiple Ruby versions.
- Use different versions for different projects.
- Isolate gemsets for better dependency management.
Checking Ruby Version in rbenv
rbenv is another lightweight version manager that’s gained popularity for its simplicity. To check Ruby version with rbenv, run:
This shows the active Ruby version, such as 3.3.5 (set by /path/to/.ruby-version). You can also list all installed versions with:
The active version will have an asterisk next to it. rbenv is especially popular on macOS, so if you’re looking to check Ruby version on Mac, this method is a go-to for rbenv users.
Checking Ruby Version Using which
The which command shows you the location of the Ruby executable that your terminal is using.
This doesn't show the version directly but tells you where Ruby is being executed from. Combine it with ruby -v for clarity. It’s useful when you have multiple Ruby versions installed.
Checking Ruby Version Using gem env
The gem command, part of RubyGems, isn’t just for managing packages—it can also tell you about your Ruby environment. To check version of Ruby, type:
This spits out a bunch of info, including a line like RUBY VERSION: 3.3.5 (2025-06-12 patchlevel 123) [x86_64-darwin22]. Look for the RUBY VERSION field to find what you need. This method is useful when you want a detailed snapshot of your Ruby setup, including paths and platforms.
Checking Ruby Version in IDEs or Text Editors
If you’re using an IDE like RubyMine or a text editor like VS Code, you can often check Ruby version right from the interface. For example:
- RubyMine: Go to Tools | Show Gem Environment to see the Ruby version and gem details. RubyMine also detects version managers like RVM or rbenv and shows the active Ruby version in the status bar.
- VS Code: With extensions like “Ruby” or “Solargraph,” the Ruby version often appears in the status bar or via a command like ruby -v in the integrated terminal.
This is a lifesaver when you’re deep in a project and need to check ruby version without switching to a terminal.
Checking Ruby Version in Frameworks or Applications
If you’re working with frameworks like Ruby on Rails, you can check Ruby version indirectly through project files. For Rails, open the Gemfile.lock in your project directory. Look for the ruby directive, which might say something like ruby 3.3.5. Alternatively, run:
This shows the Rails version, but you can infer the Ruby version from the Gemfile or by running ruby -v in the project’s context. This method is key for ensuring your framework and Ruby version are in sync.
Checking Ruby Version in Docker or Virtual Environments
If you’re using Docker or another virtual environment, checking Ruby version depends on the setup:
-
Docker: Run docker exec
ruby -v to check the version inside the container. For example, if your container is named myapp, you’d run docker exec myapp ruby -v. - Virtual Environments: If you’re using tools like Vagrant or WSL, open a terminal in the environment and use ruby -v or rbenv commands as described above.
This ensures you’re checking the version specific to the isolated environment, which might differ from your system’s Ruby.
Checking Ruby Version in Package Managers (Using Bundler)
Bundler is a gem dependency manager that can also help with checking Ruby version. In your project directory, run:
This shows the Ruby version specified in the Gemfile.lock, like ruby 3.3.5. It’s a great way to confirm the version your project expects, especially when working with teams to avoid version mismatches.
Online Tools for Ruby Version Detection
Sometimes, you might want to check Ruby version without touching your local setup. In such cases, online tools can help, especially for testing code snippets or verifying compatibility.
Websites like Replit or CodePen lets you run Ruby code in a browser-based environment, often displaying the Ruby version (e.g., 3.3.5) in the console or settings. These tools are handy for quick checks or when you’re on a machine without Ruby installed. Just paste ruby -v into the console, and you’re good to go.
Online Tool for Rails Gems Compatibility Checker
When it comes to ensuring your Rails app works with the newest version of Ruby, tools like RailsUp are a game-changer. RailsUp is an online compatibility checker that analyzes your Rails project’s gems to flag potential issues. Here’s why it’s awesome:
Features: RailsUp scans your Gemfile and Gemfile.lock to check compatibility with Rails gems. It highlights deprecated gems, suggests updates, and even warns about known bugs in specific versions.
Benefits: It saves you hours of debugging by catching issues before they break your app. Plus, it offers recommendations for upgrading to the newest version of Rails or replacing outdated gems with modern alternatives.
How to Use: Upload your Gemfile to the RailsUp website, select the target Rails version (like Rails 8.0), and let it do its magic. You’ll get a detailed report on what’s compatible and what needs fixing.
RailsUp is especially useful for teams maintaining legacy Rails apps or planning upgrades, ensuring a smooth transition to newer Ruby versions.
Conclusion
Being aware of which Ruby version you’re working with is critical for developing, deploying, and debugging applications. From command-line methods to tools like RVM, rbenv, and even Docker, there are multiple reliable ways for checking Ruby version.
Use the method that best suits your workflow and environment. And if you're managing a Rails app, tools like RailsUp can make your upgrade path smoother by not just letting you check Ruby version, but also ensuring compatibility across your stack.
Now that you know how to check Ruby version, go ahead and verify yours. Whether you're using macOS, Linux, or Windows, the steps are straightforward and help you stay in control of your development environment.