MacOS user here. I am trying to build a website hosted on github. Followed the instructions from this website but used a different jekyll theme. When I try to preview my website locally via
bundle exec jekyll serve
I get the following error:
Could not find 'bundler' (2.5.7) required by your /Users/ad/Desktop/Website/Gemfile.lock. (Gem::GemNotFoundException) To update to the latest version installed on your system, run
bundle update --bundler
. To install the missing version, rungem install bundler:2.5.7
When I try bundle update --bundler
, it says
You must use Bundler 2 or greater with this lockfile.
My bundler version is Bundler version 1.17.2
.
How can I get bundle exec jekyll serve
to run?
I tried to install a second version of ruby using homebrew since I read that one cannot update the preinstalled MacOS version of ruby. ruby-install -V
gives ruby-install: 0.9.3
.
However, chruby -h
gives zsh: command not found: chruby
.
When I use open -e ~/.zshrc
, I get
source /usr/local/opt/chruby/share/chruby/chruby.sh
source /usr/local/opt/chruby/share/chruby/auto.sh
chruby ruby-3.3.3.
Please help...
There are different ways, but what I do is:
Install https://brew.sh (a package manager for macOS)
Install rbenv (a version manager for different ruby versions)
brew install rbenv
echo 'eval "$(rbenv init - zsh)"' > ~/.zshrc
Open new terminal and cd
into your repository
Create a file called .ruby-version
in your repo with the contents 3.3.3
(or whatever ruby version you want to run)
rbenv install
(after that, ruby -v
should print 3.3.3)
bundle install
(install jekyll and its dependencies)
bundle exec jekyll serve
(start your dev server)