Install any Ruby version in seconds using rv
When you’re working with Ruby, setting up ruby in your development environment is one of the most important tasks. As you start creating or modifying projects, managing different versions and configuring dependencies can become a challenging task.
In this guide, you'll learn how to use rv, a very fast version and package manager for Ruby to get started in minutes instead of hours. You'll be amazed of how fast the commands run and you won't need wait to compile anything ever again.
Install
On macOS or Linux, install rv with Homebrew:
brew install rv
Alternatively, use the standalone installer script:
curl -LsSf https://rv.dev/install | sh
On Windows, open PowerShell as Administrator and run:
powershell -ExecutionPolicy Bypass -c "irm https://rv.dev/install.ps1 | iex"
You’re now ready to start using any version of ruby in your projects. You won't have to think about Ruby versions or gem dependencies when you want to run something. You can use rv for the following use cases:
run any command or script
rv run myscript.rb - This will automatically install ruby in seconds and let you run it.
run any gem CLI directly
rvx hanami new - Installs both ruby and the required CLI dependency to run the CLI tool.
install project dependencies
rv clean-install - If you have an existing project, this command will install Ruby and gems from Gemfile.lock
Note: On Windows PowerShell, uservwinstead ofrvbecauservis an alias for the built-inRemove-Variable.
Before you go
If you want to learn more about it, checkout this blog post with the latest rv plan and progress update. For learning other commands or getting familiar with the tool, visit the code repository.
If you run into any problem, feedback or have questions about the process, you can create a new topic with the #rv tag in the Ruby Users Forum.
Discussion