Testing github pages locally

2021, Mar 26    

Install Ruby

Here are steps I’ve used on Mac M1 to install rbenv , initiliase it & install Ruby version 2.7.1

brew install rbenv
rbenv init
eval "$(rbenv init -)"
RUBY_CFLAGS="-w" rbenv install 2.7.1
rbenv global 2.7.1
ruby -v

Verify Ruby environment is ok via “rbenv-doctor” :

curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash

You would see something like :

Checking `rbenv install' support: /opt/homebrew/bin/rbenv-install (ruby-build 20220910.1)
Counting installed Ruby versions: 1 versions
Checking RubyGems settings: OK
Auditing installed plugins: OK

For ruby 3, you might see “webrick” error. You can apply folloring workaround

gem "webrick"

Install Jekyll & Bundler

sudo gem install --user-install bundler jekyll

Install packages :

bundle install

Serve content locally :

bundle exec jekyll serve

Visit local version in browser :

http://127.0.0.1:4000/