Run Jekyll on Mac OS Big Sur on Apple Silicon/M1
Revision history
- 2021-06-28 - Firstly published
- 2022-06-13 - Edit to make it more readable
Q: Would Jekyll V4.2 (current) run on big Sur with Apple Silicon?
A: No!… but Yes.
Here is one of the original issues raised by Apple Silicon users to jekyll Github repository.
TL;DR:
As of writing this post today in end of June 2021, for every single Apple Silicon machine out of the box, the answer remains.
Before install V3 Ruby via Brew I did have tried a few walk-arounds including uninstall and re-install sass gem package as [@slycke](https://github.com/jekyll/jekyll/issues/8576#issuecomment-798080994) suggested, but did not replace the ffi as the sys already got higher version. I gained no success eventually.
Instead of further messing up the OS I tend to agree with [@monfresh](https://github.com/jekyll/jekyll/issues/8576#issuecomment-812269668) just go with HomeBrew for a potentially better Version 3.0.x Ruby. Similar lessons were learned by Apple users trying to upgrade/break their shipped Python Ver 2.x on earlier versions of macOS.
Just to be clear I did not entirely follow [@monfresh](https://github.com/jekyll/jekyll/issues/8576#issuecomment-812269668) for using his great script as I only wanted things simple and fixed on purpose.
After running HomeBrew flavoured Ruby (Ver 3.0.x) I was able to set up Jekyll Ver 4.2 running following the [official instructions](https://jekyllrb.com/docs/installation/macos/).
Steps
1. Get HomeBrew
Do this if it is not already installed, for all good reasons not only sake of install Jekyll
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Reference:
- Oneliner: https://brew.sh/
- Comprehensive: https://docs.brew.sh/Installation
2. Install Ruby 3.x.x
The original trouble with Apple Silicon was originated with difficulty of having V3 Ruby installed properly. ALWAYS avoid messing around with OS shippped packages including python
and ruby
, let brew
take care everything you need.
$ brew install ruby
Then switch to use the new Ruby version by default:
reference: https://stackoverflow.com/a/65711477/3107052
$ export PATH="/usr/local/opt/ruby/bin:$PATH"
# do not forget refresh your profile to make it effective
$ source ~/.zshrc # or ~/.bashrc if you are using bash
Verify the new Ruby version:
% which ruby
# /usr/local/opt/ruby/bin/ruby
% ruby -v
# ruby 3.1.2p20 (2022-xx-xx revision xx)
3. Install Jekyll 4.2
So far you have all the prerequisites for running Jekyll 4.2. Now you can install it:
% gem install jekyll bundler
# you may have bundler already installed, if so, you may skip this
3.1 Run Jekyll
cd
into your project folder and run
% bundle exec jekyll serve
Reference:
- https://jekyllrb.com/docs/installation/macos/
- https://jekyllrb.com/docs/
Misc to care about
- Command Line Tools
you don’t really need full Xcode if you are not to dev OS apps. But good to check if you have got the CLT.xcode-select --install
Mine says follows,
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
-
set SDKROOT
no need of it for purely setting up and running Jekyll Ver 4.2 -
as mentioned in above, get HomeBrew version of Ruby: How to
and check the env as the page says to make sure your Ruby is good to go side by side with the Ver 2.6.x shipped along with big Sur. -
no need of rbenv - keep thing simple
- install Jekyll
follow exactly the instructions on the page and install thegems
into your user directory/$PATH
- as on Big Sur things work slightly different betweenglobal
and perusr
.
Strongly agree with what the next paragrah on the page syas, recommend NOT to installgems
Globally, this includesbundler
andjekyll
When you get all $PATH
correct, your Jekyll should run now.
Comment if you still were not able to get it running, so that someone in the community may have a look.
p.s.
- error of lack of
webrick
?
Yes this one is needed for running Jekyll on Ruby 3.0- run
bundle add webrick
if you have not. thenbundle exec jekyll serve
off you go - Install
webrick
if you do not have it - likely when you reach here you’ve already got it in the system.
- run