Installation Issues on MacOSX - Gem::Ext::BuildError: ERROR: Failed to build gem native extension

Hi everyone, I’m relatively new to Jekyll, and ran into an installation issue on Mac OSX environment. So here’s what I did:

- check which ruby is active, and check which version that's it's running, it gave me ruby-2.6.3.
- gem install bundler jekyll
-  Successfully installed bundler-2.1.4
-  ...
- Done installing documentation for jekyll-sass-converter, jekyll-watch, jekyll after 3 seconds
4 gems installed

So followed along the instruction, as the following:

  • mkdir Projects

  • cd Projects

  • jekyll new my-awesome-site

  • Running bundle install in /Projects/my-awesome-site…

  • Everything looks green at my terminal, until I hit the following:

    Fetching ffi 1.13.0
    Installing ffi 1.13.0 with native extensions
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

And it gave me the following instruction:

An error occurred while installing ffi (1.13.0), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.13.0' --source ''` succeeds before bundling.

In Gemfile:
  minima was resolved to 2.5.1, which depends on
    jekyll-feed was resolved to 0.13.0, which depends on
      jekyll was resolved to 4.1.0, which depends on
        jekyll-sass-converter was resolved to 2.1.0, which depends on
          sassc was resolved to 2.4.0, which depends on

Did just so, and ran the following:

- gem install ffi -v '1.13.0' --source ''

And it returned me with this:

ERROR:  While executing gem ... (OptionParser::InvalidArgument)
    invalid argument: --source
(base) gerrys-air:my-awesome-site gerryleonugroho$

Try to roll back from the beginning by uninstalling the gem, but still no luck. Has anyone encountered something similar? Mind sharing your work around it?


Have you read through the documentation at

Run without --source ''.

Ruby will use it by default.

The gem install command might not be right it installs for your user. In your project, try:

bundle install ffi

Also on macOS, with Catalina, the system ruby and its gems are locked. So avoid using that ruby.

Also you didn’t use the --user-install flag on the gem install bundler which leads me to think you might have used sudo.

I wrote I guide here on installing Ruby, Jekyll and Bundler on macOS Catalina, installing Jekyll and Bundler at the user level.

Lastly, can you can try a different project.

Hi @ashmaroli, I did, but I think there’s something weird going on with my Operating System, been figuring out on which part though. Here’s what I did:

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

Been trying to do Software Update, but nothing much happened. It’s probably on my end, I might have accidentally deleted some important compiler libraries or some sort.


Hi @MichaelCurrin,

Actually, I’m still using macOS Mojave (10.14.6), I don’t know if that would correlate much. So here how it goes:

bundle install ffi

Returned me with the following:

ERROR: "bundle install" was called with arguments ["[OPTIONS]"]
Usage: "bundle install [OPTIONS]"

And yes, you might be correct, I might have used the ‘sudo’ command while invoking those lines. I followed your instruction with the user level. Now installation went successful, but once I tried bundle exec jekyll serve it’s still throwing me the following error.

Could not find gem 'minima (~> 2.5)' in any of the gem sources listed in your Gemfile.

Not sure, what you do mean by different project though, mind elaborating further.


On second thought I’ve never had to install ffi using bundler (or gem).

So I’d say get bundler installed at the user level and ensure PATH will pick up local gems. Something like ~/.gem/…/ruby/2.6.0/bin as in my guide.

If that doesn’t work then try

gem install ffi --user-install
# or
sudo gem install ffi

And run this anywhere to check your gems

gem list

And in a project

bundle list

You created a new project from new command so you shouldn’t have to do anything special in bundler or with ffi or minima to get things to work. Check your Gemfile uses minima, your config says theme: minima and bundle list inside your project to check minima is installed.

Note that bundle config is important step to install and run gems in projects gems and not user gems.

Try clone my project which is based on the jekyll new quickstart. I use Makefile but you can also inspect those commands directly

That uses minima and jekyll 3 as your project does

Okay, here’s what I had

gem install ffi --user-install

Then it returned me the following:

WARNING:  You don't have /Users/xxx/.gem/ruby/2.6.0/bin in your PATH,
	  gem executables will not run.
Building native extensions. This could take a while...
make failed, exit code 2

Than I edited my .bash_profile to match the requirement

export PATH="/Users/xxx/.rvm/rubies/ruby-2.6.3/bin/ruby:$PATH"

But still no luck, and so I went off for the second option with sudo command.

sudo gem install ffi

Building native extensions.  This could take a while...
Successfully installed ffi-1.13.0
Parsing documentation for ffi-1.13.0
Installing ri documentation for ffi-1.13.0
Done installing documentation for ffi after 39 seconds
1 gem installed

Voila, as it appeared I need sudo prefix to run this, and added the ruby path on my .bash_profile, one way to another it just worked.

Now as I go to create a new project:

jekyll new awesome_site
New jekyll site installed in /Volumes/DATA/awesome_site
bundle exec jekyll serve

Then the web server started running:

Configuration file: /Volumes/DATA/awesome_site_config.yml
            Source: /Volumes/DATA/awesome_site
       Destination: /Volumes/DATA/awesome_site/_site
 Incremental build: disabled. Enable with --incremental
       Jekyll Feed: Generating feed for posts
                    done in 1.561 seconds.
 Auto-regeneration: enabled for '/Volumes/DATA/Projects/gerryleonugroho'
    Server address:
  Server running... press ctrl-c to stop.
[2020-06-08 23:23:18] ERROR `/favicon.ico' not found.

I don’t know what went wrong at the initial phase of installing them, or even how to reproduce the same error, but it’s working now. But I think, it wasn’t any GCC or compiler issues, which I assumed it was at the beginning (ever since I accidentally deleted my XCode, cause I barely used them and to save some space at the same time). Thanks for all the help @MichaelCurrin, really appreciate all the inputs. :smile:


Glad you sorted :slight_smile: