Error installing nokogiri: Failed to build gem native extension & libiconv is missing (OSX)

前端 未结 15 1393
无人共我
无人共我 2020-12-07 18:25

I try to clone this repo and run bundle install. The bundle process failed and throw this error:

    ...
    Installing nokogiri 1.6.2.1 with na         


        
相关标签:
15条回答
  • 2020-12-07 19:13

    Github Answer

    sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
    
    bundle install
    
    0 讨论(0)
  • 2020-12-07 19:14

    I had a similar issue with 1.6.7.2 when bundle installing on codeship with ruby 2.3.

    What worked for me was adding:

    bundle config build.nokogiri --use-system-libraries

    before

    bundle install

    0 讨论(0)
  • 2020-12-07 19:20

    Run these commands:

    gem uninstall nokogiri
    xcode-select --install
    gem install nokogiri
    

    source: http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x

    sometimes mac updates can break xcode CLI so reinstalling can fix the issue: https://github.com/sparklemotion/nokogiri/issues/1445

    0 讨论(0)
  • 2020-12-07 19:20

    Try this

    sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
    

    And then install Nokogiri

    sudo gem install nokogiri
    
    0 讨论(0)
  • 2020-12-07 19:20

    If nothing above works, Try deleting Gemfile.lock, and do reinstalling of gems.

    0 讨论(0)
  • 2020-12-07 19:26

    Deleting nokogiri in rbenv gem folder and reinstalling solved it for me.

    0 讨论(0)
提交回复
热议问题