11

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
mario
  • 111
  • 1
  • 3
  • It's a problem building native extensions. Do you have Xcode and the command-line add-on installed, with the EULA accepted? – Todd A. Jacobs Sep 03 '20 at 19:16
  • 1
    `github-pages was resolved to 1, which depends on Ruby (~> 1.9.3)` is another major problem. version 1 was released in 2013 -- use a newer version of the gem. – anothermh Sep 03 '20 at 21:52
  • `/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`, in my case `universal-darwin19` didn't exist but `universal-darwin20` did. Make a symbolic link to `universal-darwin20` named `universal-darwin19` – chepe263 Mar 12 '22 at 21:38

5 Answers5

19

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.

Jongwook Choi
  • 8,171
  • 3
  • 25
  • 22
  • 2
    This is correct, but should be `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` – sgg Jan 07 '21 at 05:45
  • ^ universal-darwin19 is misspelled in the original answer – sgg Jan 07 '21 at 05:46
  • Fixed the typo, thank you for pointing that out. – Jongwook Choi Jan 08 '21 at 15:55
  • Works, with a little Change on MacOS Monterey: `cd` into `MacOSX13.1.sdk` instead: `cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/` and then run `sudo ln -sf universal-darwin22 universal-darwin21` (without sudo it doesn't work). – jonashackt Feb 09 '23 at 10:39
6

For those on MacOS without XCode and only command line tools installed:

cd /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
sudo ln -sf universal-darwin20 universal-darwin21

...tweaking the MacOSX11.3.sdk segment in the path if need be.

PartialOrder
  • 2,870
  • 3
  • 36
  • 44
  • This answered worked for me instead of the one above due to the symbolic link creation. The target was expecting `universal-darwin21` but only `universal-darwin19` existed. `MacOSX10.15.sdk` – dcampb Aug 23 '22 at 00:04
4

I had this same problem with a different gem; I found that

/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

didn't exist, but

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20/ruby/config.h

did exist - i.e. universal-darwin20 rather than universal-darwin19.

If I ran my install command using a newer version of Ruby, it worked.

Exactly how to do this will differ for different setups. I was using rbenv, so ran rbenv local 2.6.6 before the install command.

You can read more about running multiple Ruby versions here, or you could just run a single Ruby version but try upgrading it to a newer version (e.g. brew upgrade ruby if you're using Homebrew).

Sam
  • 5,997
  • 5
  • 46
  • 66
0

I also needed a symbolic link, but my ruby installation was in a different location (/Library/Developer/... vs /Applications/Xcode.app/...), for that reason, the commands I used to fix my local github-pages installation were:

cd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/

sudo ln -sf universal-darwin19 universal-darwin20
kiewic
  • 15,852
  • 13
  • 78
  • 101
-1

cd path like your log error /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

and dupplicate and rename folder copy universal-darwin20 to universal-darwin19

now it is working.
You can try higher version ruby or rails. gem support for it