Installing Jekyll on Mac


I am very new to this and I want to install jekyll using the command:

gem install --user-install bundler jekyll

But I get this error:

ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.

current directory: /Users/kia/.gem/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c

/usr/local/opt/ruby/bin/ruby extconf.rb
checking for pkg-config for libffi… not found
checking for ffi.h… *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Has anyone experienced any similar things? Any help would be appreciated.

you will get this error if your ruby install does not include the dev tools. There are lots of mac issues on here some with step by step solutions but as a Windows user I can’t help much.

One thing I think I have noticed is macs seem to already have ruby installed and then people install ruby again and end up with conflicts between different ruby installations?

Thanks for your reply. I did install another ruby since I read that was suggested.

Correct, the version of ruby pre-installed with Sonoma even is a mere ruby 2.6.10. Hardly capable to run the latest Jekyll.

As far as maintaining a user-installed version of ruby separate from the system, I recommend a package manager, which requires pretty extensive use of the command line. Getting somewhat familiar with homebrew is a must, however as great as it is, lacks some of the advanced capabilities required to slot multiple installations of ruby into a user’s home directory and manage slotted install gems, etc al while managing updates to ruby.

I use a package manager called asdf, whcih not only supports ruby, but also allows for more complicated web projects that require node.js and/or other frameworks/libraries.

Furthermore, the build errors you encountered, sort of indicate you might not have installed the Xcode command line tools which is not installed by default. This allows macOS to use the build tools which are traditionally part of a linux desktop os… in any event here’s a nice guide here with instructions on how to install homebrew, the command line tools, and of course ruby: Check Mac Version · Update macOS · Mac Install Guide

Hope this helps!