Update Ruby!
By Evan Williamson | November 19, 2026Most folks get set up once with all the software necessary for CB then leave it (until they change computers or something breaks). Since you aren’t running the software on a server, this is generally safe–especially with something like CB that doesn’t pull in external dependencies and process external data.
However, in the current context of new security advisories coming out everyday, it is not a bad idea to keep your Ruby (and Jekyll and all its dependencies) up to date… Recently Ruby announced a series of vulnerabilities in basic functions–so now is a good time to review how to update!
1. Update your Ruby Version
Updating Ruby is different depending on your OS and how you first installed it:
- On Windows, you will be updating RubyInstaller, replacing the old version of Ruby.
- On Mac, you will first update rbenv using brew, then use rbenv to install the new version of Ruby and set it as the
globalversion. The commands are:brew upgrade rbenv ruby-buildrbenv install 4.0.10(replace “4.0.10” with the most recent stable release number)rbenv global 4.0.10(replace “4.0.10” with what ever version you just installed)
- On Linux, first update rbenv and ruby-build, then use rbenv to install the new version of Ruby and set it as the
globalversion.
2. Update Ruby Gems
Once your Ruby version is updated, close any open terminals, then open a new terminal and run:
gem update --system
This ensures you have Ruby Gems (and bundler) updated, which manages the other Ruby dependencies on your system.
3. Update your CB projects
With everything updated, when you open an existing CB project that you have been working on you will get an error message if you try to bundle exec jekyll s.
First, delete the file “Gemfile.lock” in your project folder (those dependencies are tied to the old version of Ruby).
Then run bundle install which will get fresh version of all the dependencies that match your new version of Ruby.
Now you are ready to get back to developing as normal!
4. Remove Old Ruby Versions
On Windows, you will be using the RubyInstaller uninstaller before installing a new version–so old versions are deleted before installing a new one.
However, on Mac and Linux using rbenv you are installing new versions of Ruby that can co-exist and be switched between.
To list all versions currently installed use the command rbenv versions.
If you don’t need an old version (generally you don’t), you can remove it using rbenv uninstall, like rbenv uninstall 4.0.5.
Why Have Multiple Ruby Versions?
Having a Ruby version manager (i.e rbenv) implies that you might want more than one version of Ruby… Most CB users will NOT need more than one version. However, there is use cases where you may have more than one.
Incompatibility: Generally, having the newest stable release of Ruby ensures you have all the security updates. However, sometimes Jekyll or one of it’s dependencies does not keep up, creating issues on the newest version or certain combinations of versions–i.e. dependency hell… Sass in particular has caused headaches over time. In cases where this impacts CollectionBuilder we publicize the issue in CB-Docs and this blog.
Customized projects: Sometimes you might create a highly customized project that has expressions in Sass, Liquid, or Ruby that can break with a new Ruby version.
If you need to recreate this exact working environment, run the command rbenv local 3.4.13 (replacing 3.4.13 with your working Ruby version) in your project repository.
This will create a “.ruby-version” file in your project, telling rbenv to always use that specific Ruby version in this project.
Commit “.ruby-version” and your “Gemfile.lock” (which is ignored by default) to full record the environment.
Deployment environments: Sometimes you need to match the environment that runs your deployment build to ensure what you see on your local machine development is the same as the production deploy.
For example using the default GitHub Pages build uses old versions of Ruby and Jekyll.
You can get the exact versions that will be used when building on GitHub (the github-pages Gem), but it is only compatible with Ruby 3.
To use it you should install the most recent stable 3.x version (currently 3.4.13).
The steps look like:
- In the project, add
gem "github-pages"to your “Gemfile” - Install the stable 3.x version of Ruby,
rbenv install 3.4.13 - Set it as the local version for this project,
rbenv local 3.4.13 - Install the dependencies
bundle install
CollectionBuilder