Подтвердить что ты не робот

После обновления до macOS Обновление мозаики Mojave не работает

Building native extensions. This could take a while...
ERROR:  Error installing libxml-ruby:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/libxml-ruby-3.1.0/ext/libxml
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180926-80978-eoqfjh.rb extconf.rb
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
    --with-xml2-config
    --without-xml2-config
    --with-xml2-dir
    --without-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
 extconf failure: need libxml2.

    Install the library or try one of the following options to extconf.rb:

      --with-xml2-config=/path/to/xml2-config
      --with-xml2-dir=/path/to/libxml2
      --with-xml2-lib=/path/to/libxml2/lib
      --with-xml2-include=/path/to/libxml2/include


To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/libxml-ruby-3.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/libxml-ruby-3.1.0 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/libxml-ruby-3.1.0/gem_make.out
Updating nokogiri
Building native extensions. This could take a while...
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.
4b9b3361

Ответ 1

Ошибка связана с тем, что macOS Mojave прекратил размещение стандартных файлов заголовков в /usr/include, сохраняя их только внутри каталога XCode.

Вы можете проверить это, запустив ls/usr/include и, скорее всего, этот каталог больше не существует. Напротив, обычный трюк при запуске xcode-select --install не решит проблему.

Исправление состоит в том, чтобы запустить устаревший установщик, предоставленный Apple, который установит файлы заголовков в /usr/include

sudo installer -pkg/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target/

Ответ 2

Если вы используете доморощенный, рекомендуется использовать pkg-config где он может найти библиотеку libxml2:

brew reinstall libxml2
export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"

Ответ 3

Кроме того, у вас может быть устаревшая конфигурация пучка, что мешает. Запустите bundle config build.nokogiri --use-system-libraries и он даст вам предупреждение и покажет, какая у вас конфигурация. Я следил за всеми инструкциями и переустанавливал все драгоценные камни и даже рубины несколько раз, чтобы узнать, что для этой конфигурации был установлен путь, который больше не существует.

Ответ 4

alotofnoodles,

установщик sudo -pkg/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target/

работал на меня! Tks!