Nokogiri: [install] MacOS system Ruby is incorrectly installing nokogiri-1.11.0-arm64-darwin

Created on 4 Jan 2021  路  32Comments  路  Source: sparklemotion/nokogiri

Installing or updating nokogiri on Intel Mac installs 1.11.0 arm64-darwin.

Either files for the wrong architecture are installed, or the version is labelled with the incorrect architecture.

Have you read and followed the installation tutorial at http://www.nokogiri.org/tutorials/installing_nokogiri.html?

  • [X] Yes!

What is the complete output of gem install or bundle install?

sudo -H gem install -n /usr/local/bin nokogiri

Fetching nokogiri-1.11.0-arm64-darwin.gem
Successfully installed nokogiri-1.11.0-arm64-darwin
Parsing documentation for nokogiri-1.11.0-arm64-darwin
Installing ri documentation for nokogiri-1.11.0-arm64-darwin
Done installing documentation for nokogiri after 2 seconds
1 gem installed

What are the complete contents of the mkmf.log file generated during the failed installation?
I cannot find a mkmf.log file for this install.

Tell us about your system!

What is the output from ruby -v?
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]

What is the output from gem -v?
3.0.6

What is the output from gem env?

RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.6
  - RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [universal.x86_64-darwin20]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.6.0
  - USER INSTALLATION DIRECTORY: /Users/ross.goldberg/.gem/ruby/2.6.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /Users/ross.goldberg/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-20
  - GEM PATHS:
     - /Library/Ruby/Gems/2.6.0
     - /Users/ross.goldberg/.gem/ruby/2.6.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "-n /usr/local/bin"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/ross.goldberg/.sdkman/candidates/visualvm/current/bin
     - /Users/ross.goldberg/.sdkman/candidates/maven/current/bin
     - /Users/ross.goldberg/.sdkman/candidates/kscript/current/bin
     - /Users/ross.goldberg/.sdkman/candidates/kotlin/current/bin
     - /Users/ross.goldberg/.sdkman/candidates/java/current/bin
     - /Users/ross.goldberg/.sdkman/candidates/groovy/current/bin
     - /Users/ross.goldberg/.sdkman/candidates/gradle/current/bin
     - /Users/ross.goldberg/perl5/bin
     - /usr/local/opt/[email protected]/libexec/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/local/sbin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin

If you're using Bundler:

I don't explicitly use bundler from the command line, I just run gem commands, but if gem uses bundler in the background, here's the info:

  • what is the output from bundle version?
    Bundler version 2.2.4 (2020-12-31 commit 529e536f28)
  • what is the output from bundle config? (Take care to redact any credentials)
Settings are listed in order of priority. The top value will be used.

If you're on MacOS, please note:

  • the version of XCode you have installed (if you know)
    12.3 (12C33)
  • the output of gcc -v or clang -v
gcc -v

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang -v

Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
packaginnative-gem platforosx topiinstallation

All 32 comments

@rgoldberg Hi! Thanks for opening this. It's not totally clear from the report what's going wrong, and I think that's partly because I need to start asking different questions in the template for native gem installation.

What I've pieced together is:

  • you're running Darwin on x86_64 hardware
  • your ruby is reporting it's universal.x86_64-darwin20 and gem is reporting universal-darwin-20
  • when you gem install, rubygems is choosing the arm64-darwin native gem and not the x86_64-darwin flavor

Is that all correct? What happens when you run nokogiri -v, just so there's an error message people will find if they search for it?

How did you install this ruby? I'm guessing it's the default ruby installed with MacOS. (Looks like it is, I can reproduce on my Mac with that Ruby on darwin19.)

This might be a bug with how rubygems resolves gem platforms when the ruby is a universal binary.

I'm going to have to ask some Mac users what they think about this -- my understanding was that the /System/Library/Frameworks ruby installation was intended for use by Apple and not by mere mortals; and that the recommended course of action is to use something like ruby-install to install a Ruby that's not owned by root, doesn't require 'sudo' privileges, etc.

@tenderlove @zenspider am I wrong?

So, will gem itself probably need to be updated, rather than anything in the nokogiri gem?

I don't directly use Ruby.

I'm just updating the macOS-supplied Ruby to patch security issues, fix bugs, improve performance, etc.

Installing a new version of Ruby would just add to my administrative overhead, and provide yet another vector for security issues.

Your understanding of my situation is otherwise correct.

I don't know what installed all the gems on my system.

The updated nokogiri is being installed under:

/Library/Ruby/Gems/2.6.0/gems

Where all of the current versions of my gems are located.

In:

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/gems

there are 5 old versions of gems that have newer versions in the /Library/Ruby/Gems/2.6.0/gems.

1 of those 5 is nokogiri, which is version 1.10.1.

I cannot seem to remove any of those 5 gems.

If I run:

sudo -H gem uninstall -n /usr/local/bin -i /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 -v 1.10.1 nokogiri

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.

But the directory is owned by root, which has write permissions to it and all of the nokogiri files & directories. So I'm not sure why it can't be deleted. Maybe it's protected by SIP. If so, Apple or Ruby should provide a better error message.

(the above probably isn't directly related to the wrong architecture being installed, but I just wanted to let you know about my setup, just in case it's relevant).

nokogiri -v

Ignoring libxml-ruby-3.2.1 because its extensions are not built. Try: gem pristine libxml-ruby --version 3.2.1
Traceback (most recent call last):
    7: from /usr/local/bin/nokogiri:23:in `<main>'
    6: from /usr/local/bin/nokogiri:23:in `load'
    5: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/bin/nokogiri:6:in `<top (required)>'
    4: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    3: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    2: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:13:in `<top (required)>'
    1: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle, 0x0009): could not use '/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle' because it is not a compatible arch - /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle (LoadError)
    8: from /usr/local/bin/nokogiri:23:in `<main>'
    7: from /usr/local/bin/nokogiri:23:in `load'
    6: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/bin/nokogiri:6:in `<top (required)>'
    5: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    4: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    3: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:11:in `<top (required)>'
    2: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:32:in `rescue in <top (required)>'
    1: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
    9: from /usr/local/bin/nokogiri:23:in `<main>'
    8: from /usr/local/bin/nokogiri:23:in `load'
    7: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/bin/nokogiri:6:in `<top (required)>'
    6: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    5: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    4: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:11:in `<top (required)>'
    3: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:32:in `rescue in <top (required)>'
    2: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
    1: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
    8: from /usr/local/bin/nokogiri:23:in `<main>'
    7: from /usr/local/bin/nokogiri:23:in `load'
    6: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/bin/nokogiri:6:in `<top (required)>'
    5: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
    4: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
    3: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
    2: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:13:in `<top (required)>'
    1: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle, 0x0009): could not use '/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle' because it is not a compatible arch - /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle (LoadError)
    9: from /usr/local/bin/nokogiri:23:in `<main>'
    8: from /usr/local/bin/nokogiri:23:in `load'
    7: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/bin/nokogiri:6:in `<top (required)>'
    6: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
    5: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
    4: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
    3: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:11:in `<top (required)>'
    2: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:32:in `rescue in <top (required)>'
    1: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
    10: from /usr/local/bin/nokogiri:23:in `<main>'
     9: from /usr/local/bin/nokogiri:23:in `load'
     8: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/bin/nokogiri:6:in `<top (required)>'
     7: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
     6: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
     5: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
     4: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:11:in `<top (required)>'
     3: from /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-arm64-darwin/lib/nokogiri.rb:32:in `rescue in <top (required)>'
     2: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
     1: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)

@rgoldberg It sounds like you're describing some limitations in how Apple installs that version of Ruby and the default version of Nokogiri (v1.10.1). I can't comment on how to update Ruby or gems, or even if that's possible.

So, will gem itself probably need to be updated, rather than anything in the nokogiri gem?

I suspect this is actually the way Apple is building and installing this version of Ruby to report it's a 'universal' platform when it's not, really.

I'm going to leave this issue here for a bit to see if Apple users understand what's happening and will comment.

@rgoldberg Could you try to force the correct platform for nokogiri like so?

gem uninst nokogiri
gem inst nokogiri --platform x86_64-darwin
nokogiri -v

@larskanis That seems to have installed the correct platform.

Thanks.

nokogiri -v

# Nokogiri (1.11.0)
    ---
    warnings: []
    nokogiri:
      version: 1.11.0
      cppflags:
      - "-I/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-x86_64-darwin/ext/nokogiri"
      - "-I/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-x86_64-darwin/ext/nokogiri/include"
      - "-I/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-x86_64-darwin/ext/nokogiri/include/libxml2"
    ruby:
      version: 2.6.3
      platform: universal.x86_64-darwin20
      gem_platform: universal-darwin-20
      description: ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
      engine: ruby
    libxml:
      source: packaged
      precompiled: true
      patches:
      - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
      - 0002-Remove-script-macro-support.patch
      - 0003-Update-entities-to-remove-handling-of-ssi.patch
      - 0004-libxml2.la-is-in-top_builddir.patch
      - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
      - 0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch
      - 0007-use-new-htmlParseLookupCommentEnd-to-find-comment-en.patch
      - '0008-use-glibc-strlen.patch'
      - '0009-avoid-isnan-isinf.patch'
      libxml2_path: "/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.0-x86_64-darwin/ext/nokogiri"
      iconv_enabled: true
      compiled: 2.9.10
      loaded: 2.9.10
    libxslt:
      source: packaged
      precompiled: true
      patches: []
      compiled: 1.1.34
      loaded: 1.1.34
    other_libraries:
      zlib: 1.2.11
      libiconv: '1.15'

Obviously, some way to avoid manually specifying the workaround should be devised.

Unfortunately, gem outdated has issues with the platform, too:

$ gem list nokogiri

*** LOCAL GEMS ***

nokogiri (1.11.0 x86_64-darwin, 1.10.1)

$ gem outdated

nokogiri (1.10.1 < 1.11.0)

It appears that I can't remove 1.10.` or change the platform for that version since it appears to be locked by Apple (probably via SIP).

So gem outdated will always report a "newer" version for it, which will be 1.11.0 arm64-darwin until this problem is fixed.

Do you think we should open an issue in gem or elsewhere?

I've created an issue at https://github.com/rubygems/rubygems/issues/4234

@rgoldberg I can't seem to reproduce this locally this morning (though I could yesterday), so if possible I'd greatly appreciate you responding to requests for more information on that issue.

@flavorjones Will do. Thanks.

FYI, I'm running Big Sur 11.1.

1.11.1 correctly installs for x86_64-darwin.

I don't know what you did, but my problem seems to have been fixed. I don't know if other people will still have problems.

I'd imagine that using universal binaries would be better than architecture-specific ones in the long run.

There's still one issue: gem continually tries to update nokogiri because of the nokogiri that Apple has installed (and prevents me from removing) located at:

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1

In Terminal:

$ gem list nokogiri

*** LOCAL GEMS ***

nokogiri (1.11.1 x86_64-darwin, 1.10.1)

$ gem outdated
nokogiri (1.10.1 < 1.11.1)

Before architecture-specific nokogiri, if, e.g., 1.10.10 was the latest version, and it was already installed on my system, gem outdated wouldn't report nokogiri as outdated. i.e. I'd get the following in Terminal:

$ gem list nokogiri

*** LOCAL GEMS ***

nokogiri (1.10.10, 1.10.1)

$ gem outdated

If universal binaries can run on older versions of macOS, maybe if you make nokogiri universal, then you can remove the architecture specifier and gem outdated won't report nokogiri as being outdated.

I'm fixing the gem outdated issue at https://github.com/rubygems/rubygems/pull/4248.

I don't know what you did, but my problem seems to have been fixed

I think there's a nondeterministic aspect to this issue. I suspect the rubygems.org API may return candidate gems in non-deterministic order, and gem install uses the first one that matches. If arm64 is listed first, it's used; but if x86_64 is listed first, it's used.

@deivid-rodriguez Thanks for the great work on all this! You rock.

@flavorjones We're discussing fixes at rubygems/rubygems#4248

Thank you @flavorjones :heart_eyes:.

I have to say the same thing, your work on nokogiri is just amazing :1st_place_medal:.

I think there's a nondeterministic aspect to this issue. I suspect the rubygems.org API may return candidate gems in non-deterministic order, and gem install uses the first one that matches. If arm64 is listed first, it's used; but if x86_64 is listed first, it's used.

Yeah, I suspect the same thing. API results are originally picked up from DB, and DBs don't guarantee consistent ordering for equally ranked tuples. It should all get fixed once rubygems fixes its priorities :)

Is someone able to reproduce the issue at the moment? If yes, it'd be nice if you could try https://github.com/rubygems/rubygems/pull/4238 to verify it really fixes the issue. If nobody can verify it, I'll still move it forward but a manual confirmation would be nice.

@deivid-rodriguez Thank you for digging into the problem! I unfortunately cannot reproduce the problem at the moment. Maybe someone here with an M1 can?

If someone can repro, the steps to try the PR would be to clone the rubygems repo, checkout the PR's branch, and run ruby setup.rb to install the latest rubygems & bundler. If you want to revert the changes after that, you can run gem update --system <previous_rubygems_version>.

On macOS 11.1 x86_64 (so not arm64 / Apple Silicon M1), gem outdated from the released version of gem still outputs nokogiri (1.10.1 < 1.11.1).

ruby setup.rb from the arch branch outputs the following ignores & error:

Ignoring bigdecimal-3.0.0 because its extensions are not built. Try: gem pristine bigdecimal --version 3.0.0
Ignoring date-3.1.1 because its extensions are not built. Try: gem pristine date --version 3.1.1
Ignoring dbm-1.1.0 because its extensions are not built. Try: gem pristine dbm --version 1.1.0
Ignoring etc-1.2.0 because its extensions are not built. Try: gem pristine etc --version 1.2.0
Ignoring fcntl-1.0.0 because its extensions are not built. Try: gem pristine fcntl --version 1.0.0
Ignoring fiddle-1.0.7 because its extensions are not built. Try: gem pristine fiddle --version 1.0.7
Ignoring io-console-0.5.6 because its extensions are not built. Try: gem pristine io-console --version 0.5.6
Ignoring json-2.5.1 because its extensions are not built. Try: gem pristine json --version 2.5.1
Ignoring libxml-ruby-3.2.1 because its extensions are not built. Try: gem pristine libxml-ruby --version 3.2.1
Ignoring libxml-ruby-3.1.0 because its extensions are not built. Try: gem pristine libxml-ruby --version 3.1.0
Ignoring nokogiri-1.10.1 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.1
Ignoring openssl-2.2.0 because its extensions are not built. Try: gem pristine openssl --version 2.2.0
Ignoring psych-3.3.0 because its extensions are not built. Try: gem pristine psych --version 3.3.0
Ignoring racc-1.5.2 because its extensions are not built. Try: gem pristine racc --version 1.5.2
Ignoring sdbm-1.0.0 because its extensions are not built. Try: gem pristine sdbm --version 1.0.0
Ignoring sqlite3-1.4.2 because its extensions are not built. Try: gem pristine sqlite3 --version 1.4.2
Ignoring sqlite3-1.3.13 because its extensions are not built. Try: gem pristine sqlite3 --version 1.3.13
Ignoring stringio-3.0.0 because its extensions are not built. Try: gem pristine stringio --version 3.0.0
Ignoring strscan-3.0.0 because its extensions are not built. Try: gem pristine strscan --version 3.0.0
Ignoring zlib-1.1.0 because its extensions are not built. Try: gem pristine zlib --version 1.1.0
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /Library/Ruby/Site/2.6.0/rubygems.rb

Now, whenever I run any gem command, the above ignores are also output; they were not output by gem before I ran ruby setup.rb, so that command broke something.

I tried sudo ruby setup.rb, but got the same ignores with the following different error:

ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem

Some info:

ls -ld /Library/Ruby/Site/2.6.0/rubygems.rb
-rw-r--r--  1 root  wheel  37910 Jan 13 22:51 /Library/Ruby/Site/2.6.0/rubygems.rb

ls -ld /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem
-rwxr-xr-x  1 root  wheel  596 Jan  1  2020 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem

The first error is probably standard ACL; the second is probably macOS SIP.

My gem update script uses sudo -H gem update -n /usr/local/bin, so I assume that I need to inform ruby setup.rb to use /usr/local/bin, but I don't know its options.

@flavorjones Can you release nokogiri as universal releases, instead of as platform-specific releases?

That would avoid all these issues on macOS (though the gem platform issues themselves should still be fixed by the gem maintainers).

@rgoldberg The gem outdated issue has not yet been fixed (PR isstill opened).

Regarding upgrading rubygems, sorry I didn't noticed you were using a globally installed ruby :grimacing:, I'm not sure how to install rubygems from source on that ruby. In any case, those warnings indicate that something is not correct in my PR. Can you downgrade back to your previous working installation with gem update --system <previous_version>?

Thanks for trying this by the way, and sorry for partly breaking your installation :disappointed:.

@deivid-rodriguez I already downgraded. Things seem fine now. No problem about breaking things. You meant well.

Is there any way for me to help you figure out how to fix your PR?

Have you looked into the gem outdated issue? Might that be fixed by your PR to install the correct arch?

@deivid-rodriguez I already downgraded. Things seem fine now. No problem about breaking things. You meant well.

That's a relief :sweat_smile:.

Is there any way for me to help you figure out how to fix your PR?

I'll try look into it, maybe I can tell you to add some debugging prints here and there.

Have you looked into the gem outdated issue? Might that be fixed by your PR to install the correct arch?

That should be fixed by rubygems/rubygems#4248. It should be almost ready, just pending evaluation of whether it needs any tweaks to accommodate backwards compatibility concerns. In any case, that issue shouldn't affect anything else that gem outdated giving incorrect information.

@deivid-rodriguez Thanks for the info, and for fixing these issues.

I'm curious as to why no one else reported these issues before. Was gem changed recently, or are these problems only happening on macOS, not on other OSes like Linux (which I assume has supported multiple architectures for a while)?

I think since nokogiri started shipping precompiled gems for linux and MacOS, these issues in rubygems become more apparent now.

Did gem only recently start supporting precompiled gems, or were they technically feasible before, but no popular gems did it? Or something else?

Thanks for the info. I'm just intrigued by this all coming up now instead of in the past. It's nice to learn the history.

@flavorjones Can you release nokogiri as universal releases, instead of as platform-specific releases?

No. Universal implies it's a combination arm and x86 executable. This is neither necessary nor easy to do.

@deivid-rodriguez Is there anything I can do to help with your PRs?

As I said before, I'll look into it, and try to figure out some good places for debugging prints that will give us better info about environments where this is happening. I'm just too busy with other things now, so not for the moment. As far as I understand, you're still consistently getting the issue, but have the --platform workaround, correct?

@deivid-rodriguez Yeah, I use the workaround when necessary.

I also run outdated in the same script in which I perform upgrades, so I continually get spurious out-of-date messages for nokogiri, which causes my script to try to upgrade it.

It's not the end of the world, but I didn't want you waiting on anything that I could help with.

Good luck with your other commitments.

I recently read a related blog post, Do not use MacOS system Ruby 路 Mac Install Guide.

I'm going to go ahead and close this issue because it seems pretty clear that this isn't a Nokogiri problem per se, but something that bundler/rubygems should be modified to handle.

Was this page helpful?
0 / 5 - 0 ratings