Can't install Jekyll - "fatal error: 'openssl/ssl.h' file not found"

I am attempting to locally host a Jekyll site on Mac OS.
Upon downloading Jekyll with gem install jekyll I am met with error:

current directory: /Users/main/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
make DESTDIR\= sitearchdir\=./.gem.20221106-46436-a98sx9 sitelibdir\=./.gem.20221106-46436-a98sx9
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:119:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make: *** [binder.o] Error 1

make failed, exit code 2

I am on MacOS Ventura 13.0.

  • openssl version returns LibreSSL 3.3.6

  • jekyll -v returns can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException) (obviously)

  • ruby -v returns ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin22]

  • gem -v returns 3.3.25

  • bundle -v returns Bundler version 2.3.25

  • rvm list returns =* ruby-3.0.0 [ x86_64 ]

  • gem list returns

rubygems-bundler (1.4.5)
rubygems-update (3.3.25, 3.0.0)
rvm (1.11.3.9)

… among other things. No Ruby version is listed.

I have attempted brew link --force openssl , so that I can run gem install event machine (with flags), but brew link --force openssl returns

If you need to have openssl@3 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc

I ran that command, re-ran brew link --force openssl, and it returned the same error.

What do I do?
Thank you for any help.

Do you have the perquisites installed?

Also I created this video that shows how to install Jekyll on a Mac (it says Apple Silicon but works on Intel Macs as well):

Or if you don’t want to deal with installing Ruby and putting all this code on your computer, you can use Docker containers which is what I do on my Mac nowadays:

I’ve also been unable to get things re-installed with MacOS Ventura 13.0.1

I’ve been going through the install steps here: https://jekyllrb.com/docs/installation/macos/

And when I do: ruby-install ruby
I get this error:

compiling variable.c

./tool/file2lastrev.rb:6:in `require’: cannot load such file – optparse (LoadError)

from ./tool/file2lastrev.rb:6:in `’

make: *** [revision.tmp] Error 1

!!! Compiling ruby 3.1.2 failed!

Honestly, I gave up messing with it. I’m using the Docker method and it works perfectly. I’d go that route if I had to deal with this again.
Gl :slight_smile:

try uninstalling ruby and re-install it. I think macs have a built in/system version of ruby and seems to have conflicts of some sort.

my best solution, easy, and it works for all citizens of the world.

Go and get windows computer.

Now now @ninja. No need to go there.

I think @rdyar is on the right track. Look at this thread, which shows how to uninstall and re-install Ruby.

macOS comes with a version of Ruby installed that [I guess??] Apple uses and is locked down. That is what makes things a little more complicated.

Hopefully, this resolves the issue!

There seems to be some sort of conflict between MacOS 13 and Xcode 14.

This post says that there is a fix in Ruby 3.1.3 but when I do rbenv install 3.1.3 I get this error:

Installing ruby-3.1.3...
ruby-build: using readline from homebrew

BUILD FAILED (macOS 13.1 using ruby-build 20221225)

Inspect or clean up the working tree at /var/folders/cn/ws27369s34z4503m3qxqbr780000gn/T/ruby-build.20221228130313.48649.DBSkdk
Results logged to /var/folders/cn/ws27369s34z4503m3qxqbr780000gn/T/ruby-build.20221228130313.48649.log

Last 10 log lines:
compiling dln.c
compiling localeinit.c
compiling array.c
compiling mjit.c
./tool/file2lastrev.rb:6:in `require': cannot load such file -- optparse (LoadError)
	from ./tool/file2lastrev.rb:6:in `<main>'
make: *** [revision.tmp] Error 1
make: *** Waiting for unfinished jobs....
/bin/sh ./tool/ifchange "--timestamp=.rbconfig.time" rbconfig.rb rbconfig.tmp
rbconfig.rb updated