Running Jekyll on MacOs M1
( If you don’t know what Jekyll is. I recommend checking out their site here)
I bought a new 14-inch Macbook Pro at late 2021 and spent some times to configure and transferred all my previous files into my new mac machine. I didn’t have time to run Jekyll again as I was busy working for a long (and complicated) project at my job.
Later today on weekends, I started pulling Jekyll repo on Github back to make an attempt to write a post about Jest & Testing library with Msw (coming soon! 👌) and I ran into an issue that Jekyll could’t execute bundle and run.
Therefore, I am writing this post in order to help other people to solve the issues as I had earlier so they don’t need to go through all the hassles and just get it run 😄.
Without any futher delay, let’s get started !
Installing new Ruby version
You probably are having the issue at the moment andI cannot remember what exact error was, but apparently we know that jekyll couldn’t run. As I thought the problem was my new Macbook M1 chip, as I searched around. I found out this post here stating that
Jekyll is compatible with macOS with ARM64 architecture. However, bundle exec jekyll serve may fail with older version ffi
You may need to run bundle update or update ffi to at least 1.14.2 manually.”
As it also states in the post that MacOS Big Sur 11.3.0 has inbuilt Ruby version 2.6.3p62 and it’s not compatible with Jekyll newer version (such as 4.2.0) And so, we need to install a newer version of Ruby to get started with.
After finish installing, I’d recommend setting $PATH, $GEM_PATH and $GEM_HOME (I’m using zshell
and put inside ~/.zshrc
but you can also use bash
and put inside ~/.bash_profile
) the following:
NOTE: Make sure you set the right PATH
indicated after ruby has been installed. In some cases, the message for PATH
could be like the following:
Then you need to set GEM_HOME
and GEM_PATH
to be /usr/local/lib/ruby/gems/3.1.0
Installing Ruby ffi
Ruby-FFI is a gem for programmatically loading dynamically-linked native libraries, binding functions within them, and calling those functions from Ruby code.
In order to install Ruby ffi, run:
Installing Webrick
I stumbled upon this question when I ran into the issue of trying to set up github pages. It seems that in the latest version of Ruby that is installed with homebrew webrick
is not included by default
Therefore, we need to install it manually with homebrew
Running Jekyll
And it’s done, we now can try running Jekyll with Live Reload
.
Hope this post is useful for you and if you have any questions, feel free send an email to me. Cheers.