libxml-ruby: Failed to build gem native extension

后端 未结 7 1238
逝去的感伤
逝去的感伤 2021-02-07 19:24

I\'m trying to install libxml-ruby. I have installed libxml2, libxslt and coreutils

I have also read other posts rega

7条回答
  •  别那么骄傲
    2021-02-07 20:19

    Homebrew:

    libxml2 is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble.

    So, we need to set libxml path directly

    brew install libxml2
    
    gem install libxml-ruby \
    -- \
    --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config"
    

    P.S.

    If you get the exception on lastest rubies:

    Just ignore it. The gem was successfully installed. Just the Rdoc documentation generation failed.

    The internal error was:
    
            (NoMethodError) undefined method `[]' for nil:NilClass
    
    ERROR:  While executing gem ... (NoMethodError)
        undefined method `[]' for nil:NilClass
    

提交回复
热议问题