To include Ruby 3.1 as one of the available install options, first upgrade ruby-build:
brew update && brew upgrade ruby-build
See all available versions with rbenv install --list.
Ruby 3.1.0 should return in the result.
2. Install Ruby 3.1.0
rbenv install3.1.0
3. Set local Ruby version
rbenv local3.1.0
You can verify that the .ruby-version file in the root of your folder now lists version 3.1.0.
4. Update Gemfile
# oldruby "3.0.3"# newruby "3.1.0"
bundle install
You might run into the error cannot load such file -- net/smtp (LoadError). net-smtp has been removed from the default gems in ruby 3.1. As Action Mailbox depends on net/smtp temporarily add to your gemfile until the mail gem includes it as a dependancy.
gem "net-smtp",require:false
5. Debug gem
The debug gem is the new preferred debugger. Alternative gems like pry are no longer necessary. Rails 7 includes the debug gem by default.
Gemfile:
group :development,:testdo# old gem 'pry'# new gem "debug",">= 1.0.0"end