Avoid using the ruby directly on your mac:
# check which gem you are using
# the system one is /usr/bin/gem
which gem
command which gem
# check which ruby
# the system one is /usr/bin/ruby
# default: ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin25]
which ruby
ruby --version
To keep things clean, try to use rvm
, which manages multiple ruby install for you.
rvm
may depend on brew
to install ruby# make sure RVM is the latest
rvm get head
rvm reload
# check the current activated ruby
rvm current
# check the one installed
rvm list
# install
# ! important to use ruby 3.1
rvm install ruby-3.1
# if you installed multiple ruby make sure to set the default one to the 3.1 version
rvm --default ruby-3.1
# after install, check if the local install is used
# it should show ~/.rvm/rubies/<version>/
rvm list
which ruby
command which gem
bundler
and jekyll
gem install bundler jekyll
# run the website
gem exec jekyll serve --livereload
# use the server address (on port 4000) in the output
LiveReload address: <http://127.0.0.1:35729>
Server address: <http://127.0.0.1:4000/>
bundle
# this will update the Gemfile.lock
# Gemfile.lock serves as the "requirements.txt" generated by pip freeze
# bundle automatically setup the project's required gems by looking at Gemfile.lock
# assuming we update to the newer ruby later, we need to run this command to use the latest gems
bundle update