timoweaver
timoweaver

Reputation: 141

Issues serving Jekyll to localhost, eventmachine 1.2.7 has an error when installing

Not sure what to do to specifically fix this problem, googled and nothing solved my question. When I try to:

bundle exec jekyll serve

I get told:

Could not find eventmachine-1.2.7 in any of the sources
Run `bundle install` to install missing gems.

Then I:

bundle install

Only to get this:

Installing eventmachine 1.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /private/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/gems/eventmachine-1.2.7/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20201130-34411-pd54nh.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/gems/eventmachine-1.2.7 for
inspection.
Results logged to
/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/extensions/universal-darwin-20/2.6.0/eventmachine-1.2.7/gem_make.out

An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'` 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.0.0, which depends on
        em-websocket was resolved to 0.5.1, which depends on
          eventmachine

Where am I going wrong here? Just updated to macOS 11.0.1, this is my first time trying to serve jekyll since the update. Thanks y'all!

Upvotes: 14

Views: 8946

Answers (3)

ivanz
ivanz

Reputation: 195

Just try:

gem install eventmachine -v '1.2.7' -- --with-cppflags=-I/usr/local/opt/openssl/include

Upvotes: 17

Trevor Karjanis
Trevor Karjanis

Reputation: 1724

I didn't have to build ruby or install XCode. While Jekyll requires Ruby 2.4.0 or higher and Big Sur comes with 2.6.3, I followed Jekyll's instructions to install the latest version of Ruby.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ruby

Add Ruby to your shell configuration in .bash_profile.

PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH

Install bundler. I had to upgrade to Jekyll 4.2 from 4.0, and install webrick which is no longer a default gem with Ruby 3.0. If Jekyll is installed globally, then install it, webrick, and any other gems, like jekyll-paginate, too.

gem install --user-install bundler jekyll

Add the gems path to your shell configuration in .bash_profile, replacing X.X with with first two digits of the Ruby version.

PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"
export PATH

Upvotes: 1

Michael Dudar
Michael Dudar

Reputation: 31

I had the same problem on Big Sur and this solution worked perfectly:

How to fix Jekyll after upgrading to MacOS 11 (Big Sur)

Download XCODE 12 beta from here and copy it to the Applications folder.

Then follow these steps to install rbenv.

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src

Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility. see: https://github.com/rbenv/rbenv#basic-github-checkout

xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer

Now in your Jekyll project's root, you should be able to run bundle install and it should install all missing dependencies and should work now.

Upvotes: 3

Related Questions