Problem reinstalling jekyll on macOS

I recently had to restore my macbook pro (MacOS Mojave 10.14.2) from time machine, and now jekyll can’t be found so building a site fails with the following error:

/Library/Ruby/Site/2.3.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.3.0/rubygems.rb:302:in `activate_bin_path'
from /usr/local/bin/jekyll:23:in `<main>'

So I attempted to follow the installation examples on the jekyll website by first installing the xcode tools:

xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

So then I tried: gem install bundler jekyll

Bundler seems to install fine, but jekyll not so much

Successfully installed bundler-2.0.1
Parsing documentation for bundler-2.0.1
Done installing documentation for bundler after 4 seconds
Building native extensions. This could take a while...
ERROR:  Error installing jekyll:
	ERROR: Failed to build gem native extension.

    current directory: /Users/matt/gems/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20190206-33225-el8zmw.rb extconf.rb
creating Makefile

current directory: /Users/matt/gems/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" clean

current directory: /Users/matt/gems/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR="
compiling ruby_http_parser.c
In file included from ruby_http_parser.c:1:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:36:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/defines.h:34:
In file included from /usr/include/stdlib.h:66:
In file included from /usr/include/sys/wait.h:110:
/usr/include/sys/resource.h:197:2: error: unknown type name 'uint64_t'
        uint64_t ri_user_time;
        ^
/usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t'
        uint64_t ri_system_time;
        ^
/usr/include/sys/resource.h:199:2: error: unknown type name 'uint64_t'
        uint64_t ri_pkg_idle_wkups;
        ^
/usr/include/sys/resource.h:200:2: error: unknown type name 'uint64_t'
        uint64_t ri_interrupt_wkups;
        ^
/usr/include/sys/resource.h:201:2: error: unknown type name 'uint64_t'
        uint64_t ri_pageins;
        ^
/usr/include/sys/resource.h:202:2: error: unknown type name 'uint64_t'
        uint64_t ri_wired_size;
        ^
/usr/include/sys/resource.h:203:2: error: unknown type name 'uint64_t'
        uint64_t ri_resident_size;
        ^
/usr/include/sys/resource.h:204:2: error: unknown type name 'uint64_t'
        uint64_t ri_phys_footprint;
        ^
/usr/include/sys/resource.h:205:2: error: unknown type name 'uint64_t'
        uint64_t ri_proc_start_abstime;
        ^
/usr/include/sys/resource.h:206:2: error: unknown type name 'uint64_t'
        uint64_t ri_proc_exit_abstime;
        ^
/usr/include/sys/resource.h:211:2: error: unknown type name 'uint64_t'
        uint64_t ri_user_time;
        ^
/usr/include/sys/resource.h:212:2: error: unknown type name 'uint64_t'
        uint64_t ri_system_time;
        ^
/usr/include/sys/resource.h:213:2: error: unknown type name 'uint64_t'
        uint64_t ri_pkg_idle_wkups;
        ^
/usr/include/sys/resource.h:214:2: error: unknown type name 'uint64_t'
        uint64_t ri_interrupt_wkups;
        ^
/usr/include/sys/resource.h:215:2: error: unknown type name 'uint64_t'
        uint64_t ri_pageins;
        ^
/usr/include/sys/resource.h:216:2: error: unknown type name 'uint64_t'
        uint64_t ri_wired_size;
        ^
/usr/include/sys/resource.h:217:2: error: unknown type name 'uint64_t'
        uint64_t ri_resident_size;
        ^
/usr/include/sys/resource.h:218:2: error: unknown type name 'uint64_t'
        uint64_t ri_phys_footprint;
        ^
/usr/include/sys/resource.h:219:2: error: unknown type name 'uint64_t'
        uint64_t ri_proc_start_abstime;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [ruby_http_parser.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/matt/gems/gems/http_parser.rb-0.6.0 for inspection.
Results logged to /Users/matt/gems/extensions/universal-darwin-18/2.3.0/http_parser.rb-0.6.0/gem_make.out
1 gem installed

I then went back and triggered the install of the header files with

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

And this triggered the a fresh header install, but it made no difference and the output for installing jekyll was the same. At this point I’m at a bit of a loss - any help gratefully received!

I’m not a mac user, but generally I have found that this error means that the dev tools needed by ruby to build the native extensions cannot be found. On a PC I think there are 2 versions of ruby, one includes the dev tools the other does not. Not sure is this is the case on macs.

There are several other issues like this here, I would search the forum for ERROR: Failed to build gem native extension and I think you find some solutions.

1 Like

I had the same problem and spent hours before finding a solution that worked. This error seems to be popping up for people who’ve migrated from one mac to another, especially those using Mojave. Basically, the migration messes up header files in /usr/local/include. This solution worked for me (so far no side effects):

Note:
I tried many fixes (installing regular homebrew ruby, using rvm, path corrections, global vs local). Some would give me errors immediately, others would mostly work (ruby ran, bundler installed) but would always fail when installing jekyll with the same error: unknown type name 'uint64_t' until I forcefully removed the broken headers.