Cómo instalar Nokogiri en Mac OS Sierra 10.12


Estoy teniendo problemas para instalar Nokogiri (1.6.8.1) en Mac OS Sierra 10.12.

Intenté usar brew install libxml2 libxslt y luego hacer referencia a los directorios de instalación usando opciones de línea de comandos, pero no ayudó.

Author: jwpfox, 2016-10-14

7 answers

Abra Xcode y, desde el menú XCode -> Preferences actualice sus Herramientas de Línea de Comandos (Xcode 8.0).

Entonces haz:

bundle config build.nokogiri --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2
bundle install

O simplemente:

gem install nokogiri -v 1.6.8.1 -- --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2
 153
Author: Julian Popov,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-13 09:36:31

La solución más simple es ejecutar:

xcode-select --install
gem install nokogiri
 118
Author: NDan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-24 08:01:06

Intente instalar libxml2 primero con Homebrew.

brew install libxml2

Entonces si se instala con bundle

bundle config build.nokogiri --use-system-libraries \
  --with-xml2-include=$(brew --prefix libxml2)/include/libxml2
bundle install

Si se instala directamente con gem

gem install nokogiri -- --use-system-libraries \
  --with-xml2-include=$(brew --prefix libxml2)/include/libxml2
 36
Author: Quanlong,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-06 04:56:37

Esto podría ser un duplicado de falla la instalación de gema nokogiri-v '1.6.8.1' ... última respuesta aceptada que había que hacer:

brew unlink xz; bundle install; brew link xz

Puede que no sea necesario volver a enlazar xz... si, por ejemplo, solo tiene esa dependencia debido a the_silver_searcher (que enlaza directamente con la biblioteca no enlazada).

 11
Author: Orangenhain,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 11:55:19

Similar a la respuesta de yuяi y de la ayuda de Nokogiri:

brew unlink xz
gem install nokogiri
brew link xz

Http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x

Esto funcionó para 1.7.0.1

 10
Author: Rimian,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-06 01:41:22
gem update --system
xcode-select --install
brew unlink xz
gem install nokogiri -v '1.6.8.1'
brew link xz

Si los pasos anteriores no solucionan el problema, lo que también ha funcionado es ejecutar brew doctor y limpiar cualquier archivo de encabezado sin elaborar.

 9
Author: yuяi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-06-11 23:08:11

Si ha instalado nokogiri anteriormente usando bundler con bundle config build.nokogiri --use-system-libraries esta configuración seguirá ahí. Si mientras tanto ha resuelto su configuración de Xcode (como se sugiere como el método principal de instalación en la instalación de nokogiri), entonces es posible que desee intentar eliminar ese fra de bundler bundle config --delete build.nokogiri e intentar de nuevo hacer bundle install.

 0
Author: Niels Kristian,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-06 11:43:54