Updating Ruby for Mastodon

Like everything else, I’m writing this as notes for myself. If it’s helpful for you: Awesome!

This morning I saw this post:

And I figured I’d update ruby from 3.0.4 to 3.0.6 ahead of the Mastodon 4.1.2 release. Here’s how I got it updated:

Everything is run as the mastodon user.

sudo su - mastodon

Update code:

git -C /home/mastodon/.rbenv/plugins/ruby-build pull

Build new version of ruby:

RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.0.6

Point to new ruby:

rbenv global 3.0.6

That should be it.

Mastodon uses a specific version of Ruby, it is set in the file ~/live/.ruby-version.

Uninstalling Old Ruby

Updating with how to uninstall Ruby 3.0.4 from this post:

RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv uninstall 3.0.4
bundle install --redownload
yarn install
RAILS_ENV=production bundle exec rails assets:precompile
systemctl restart mastodon-web mastodon-sidekiq mastodon-streaming