Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commonmarker gem cannot be installed (needed for jekyll) macos

what do I have to do, is there a problem with dependencies? How do I fix those? I am on catalina.

I repeatedly get this error and have already looked for the directory.. doesn't exist.

sudo bundle update
Password:
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies.......
Bundler found conflicting requirements for the Ruby
version:
  In Gemfile:
    github-pages was resolved to 1, which depends on
      Ruby (~> 1.9.3)

jekyll-feed (~> 0.12) was resolved to 0.13.0, which
depends on
      Ruby (>= 2.3.0)

Bundler could not find compatible versions for gem
"commonmarker":
  In Gemfile:
    commonmarker (~> 0.21.0)

    github-pages was resolved to 203, which depends on
jekyll-commonmark-ghpages (= 0.1.6) was resolved
to 0.1.6, which depends on
        commonmarker (~> 0.17.6)
➜  blog git:(gh-pages) ✗ sudo gem install commonmarker
Building native extensions. This could take a while...
ERROR:  Error installing commonmarker:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/commonmarker-0.21.0/ext/commonmarker
/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 ./siteconf20200903-9124-19bmbh8.rb extconf.rb
creating Makefile

current directory: /Library/Ruby/Gems/2.6.0/gems/commonmarker-0.21.0/ext/commonmarker
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.6.0/gems/commonmarker-0.21.0/ext/commonmarker
make "DESTDIR="
make: *** No rule to make target `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h', needed by `arena.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/commonmarker-0.21.0 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/commonmarker-0.21.0/gem_make.out
like image 735
mario Avatar asked Sep 03 '20 18:09

mario


People also ask

Can I install Jekyll on macOS?

Older macOS versions might work, but we don’t officially support them. To install Jekyll on macOS, you need a proper Ruby development environment. While macOS comes preinstalled with Ruby, we don’t recommend using that version to install Jekyll. This external article goes over the various reasons why you shouldn’t use the system Ruby.

Should I build Jekyll 3 as a plugin or a plugin?

If this is a feature request, please consider building it first as a plugin. Jekyll 3 introduced hooks which provide convenient access points throughout the Jekyll build pipeline whereby most needs can be fulfilled.

What are hooks in Jekyll 3?

Jekyll 3 introduced hooks which provide convenient access points throughout the Jekyll build pipeline whereby most needs can be fulfilled. If this is something that cannot be built as a plugin, then please provide more information about why in order to keep this issue open.


1 Answers

Sam's comments are correct. XCode's ruby framework is broken. A workaround is to make a symbolic link:

cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
ln -sf universal-darwin20 universal-darwin19

With this, I was able to successfully build all the native extensions.

Note: You should change your path segment MacOSX11.1.sdk according to your local Xcode SDK installation.

like image 56
Jongwook Choi Avatar answered Sep 27 '22 22:09

Jongwook Choi