Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll with Ruby 2.3 on macOS 10.13 (HighSierra)

When I run $ jekyllor $ jekyll serve it raises the following error:

-bash: /usr/local/bin/jekyll: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

I checked /System/Library/Frameworks/Ruby.framework/Versions/ and Version 2.0 does not exist. It turns out that on the same day I updated on HighSierra, Version 2.3 was installed.

I think Jekyll still looks for Version 2.0. So how can I tell Jekyll to use Ruby 2.3?

Edit:

When I uninstall and then install jekyll, it fails:

$ gem install jekyll
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20171111-1004-fgop80.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.18 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/ffi-1.9.18/gem_make.out

Solution:

I googled can't find header files for ruby and it turned out that "Command Line Tools for Xcode" must be installed which you can download here: https://developer.apple.com/download/more/

However, I have macOS 10.13 and there is no command line tools for Xcode 8.x (which was the latest version I could install). That's why I searched for Xcode in the Mac App Store and installed Xcode 9. Once, it was installed, a window popped up that said "git requires command line tools. Do you want to install it?". I clicked install and still failed to run $gem install jekyll.

Then I tried $ brew doctor. There were some warnings which I fixed one by one and finally I'm able to run $ gem install jekyll.

like image 389
Maurice Wipf Avatar asked Oct 03 '17 09:10

Maurice Wipf


People also ask

Does Jekyll use Ruby?

Jekyll is written in Ruby. If you're new to Ruby, this page helps you learn some of the terminology.

How do I know what version of Jekyll I have?

If the OP has installed Jeykll locally (using gem install github-pages for example), then they can see which version of Jeykll they are using by running gem list jeykll from the command line.


1 Answers

I had the same issue. I just uninstalled jekyll

gem uninstall jekyll

and then installed it again.

gem install jekyll

Then it worked again.

like image 198
christophrumpel Avatar answered Sep 28 '22 11:09

christophrumpel