Upgrading Mastodon from 3.5.3 to 4.0.2

You can follow the 3.5.3 to 4.0.0 instructions which are here. Just remember to do git checkout v4.0.2 instead of git checkout v4.0.0.

It says in the instructions that:

The recommended Ruby version has been bumped to 3.0.4. You can upgrade, or you can continue using the old version by overwriting the .ruby-version file with e.g. 3.0.3 which was recommended previously

To upgrade the version of ruby to 3.0.4, I followed these instructions:

cd ~/.rbenv/plugins/ruby-build
git pull
cd ~/.rbenv
rbenv install 3.0.4

This took maybe 5-10 minutes to run, so be patient!

I then went back to the official instructions starting with

bundle install
yarn install

Overall it was a nice and painless upgrade!