I have tried to install mechanize on my Mac but I always get error. I tried all answers given on the site but none worked for me.
I have tried sudo gem install mechanize and I got error below.
Password:
Building native extensions. This could take a while...
ERROR: Error installing mechanize:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.8/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160703-8312-16oc548.rb extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.4.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.4.tar.gz into tmp/x86_64-apple-darwin15/ports/libxml2/2.9.4... OK
Running 'configure' for libxml2 2.9.4... OK
Running 'compile' for libxml2 2.9.4... ERROR, review '/Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.8/ext/nokogiri/tmp/x86_64-apple-darwin15/ports/libxml2/2.9.4/compile.log' to see what happened. Last lines are:
========================================================================
unsigned short* in = (unsigned short*) inb;
^~~~~~~~~~~~~~~~~~~~~
encoding.c:815:27: warning: cast from 'unsigned char *' to 'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
unsigned short* out = (unsigned short*) outb;
^~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
CC error.lo
CC parserInternals.lo
CC parser.lo
CC tree.lo
CC hash.lo
CC list.lo
CC xmlIO.lo
xmlIO.c:1450:52: error: use of undeclared identifier 'LZMA_OK'
ret = (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1;
^
1 error generated.
make[2]: *** [xmlIO.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** 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.0/usr/bin/ruby
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:366:in `block in execute': Failed to complete compile task (RuntimeError)
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `chdir'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `execute'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in `compile'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in `cook'
from extconf.rb:364:in `block (2 levels) in process_recipe'
from extconf.rb:257:in `block in chdir_for_build'
from extconf.rb:256:in `chdir'
from extconf.rb:256:in `chdir_for_build'
from extconf.rb:363:in `block in process_recipe'
from extconf.rb:262:in `tap'
from extconf.rb:262:in `process_recipe'
from extconf.rb:555:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.8/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.8/gem_make.out
I have install Xcode command line and when I do this
xcode-select -p
I get /Applications/Xcode.app/Contents/Developer
this is also the error when I try nokogiri
Admins-MBP:~ admin$ sudo gem install nokogiri
Password:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.8/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160703-27126-1ef91wn.rb extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.4.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.4.tar.gz into tmp/x86_64-apple-darwin15/ports/libxml2/2.9.4... OK
Running 'configure' for libxml2 2.9.4... OK
Running 'compile' for libxml2 2.9.4... ERROR, review '/Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.8/ext/nokogiri/tmp/x86_64-apple-darwin15/ports/libxml2/2.9.4/compile.log' to see what happened. Last lines are:
========================================================================
"_libiconv", referenced from:
_xmlIconvWrapper in libxml2.a(encoding.o)
"_libiconv_close", referenced from:
_xmlFindCharEncodingHandler in libxml2.a(encoding.o)
_xmlCharEncCloseFunc in libxml2.a(encoding.o)
"_libiconv_open", referenced from:
_xmlFindCharEncodingHandler in libxml2.a(encoding.o)
"_lzma_auto_decoder", referenced from:
_xz_head in libxml2.a(xzlib.o)
"_lzma_code", referenced from:
_xz_decomp in libxml2.a(xzlib.o)
"_lzma_end", referenced from:
___libxml2_xzclose in libxml2.a(xzlib.o)
"_lzma_properties_decode", referenced from:
_is_format_lzma in libxml2.a(xzlib.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [xmllint] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** 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.0/usr/bin/ruby
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:366:in `block in execute': Failed to complete compile task (RuntimeError)
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `chdir'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `execute'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in `compile'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in `cook'
from extconf.rb:364:in `block (2 levels) in process_recipe'
from extconf.rb:257:in `block in chdir_for_build'
from extconf.rb:256:in `chdir'
from extconf.rb:256:in `chdir_for_build'
from extconf.rb:363:in `block in process_recipe'
from extconf.rb:262:in `tap'
from extconf.rb:262:in `process_recipe'
from extconf.rb:555:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.8/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.8/gem_make.out
When I use
Admins-MBP:~ admin$ sudo gem install nokogiri -v '1.6.7.2'
Password:
Fetching: mini_portile2-2.0.0.gem (100%)
Successfully installed mini_portile2-2.0.0
Fetching: nokogiri-1.6.7.2.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160703-32388-1almq9.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.0.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
- 0003-Stop-parsing-on-entities-boundaries-errors.patch
- 0004-Cleanup-conditional-section-error-handling.patch
- 0005-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
- 0006-Another-variation-of-overflow-in-Conditional-section.patch
- 0007-Fix-an-error-in-previous-Conditional-section-patch.patch
- 0008-CVE-2015-8035-Fix-XZ-compression-support-loop.patch
- 0009-Updated-config.guess.patch
- 0010-Fix-parsering-short-unclosed-comment-uninitialized-access.patch
- 0011-Avoid-extra-processing-of-MarkupDecl-when-EOF.patch
- 0012-Avoid-processing-entities-after-encoding-conversion-.patch
- 0013-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDi.patch
- 0014-CVE-2015-5312-Another-entity-expansion-issue.patch
- 0015-Add-xmlHaltParser-to-stop-the-parser.patch
- 0016-Detect-incoherency-on-GROW.patch
- 0017-CVE-2015-7500-Fix-memory-access-error-due-to-incorre.patch
- 0018-CVE-2015-8242-Buffer-overead-with-HTML-parser-in-pus.patch
- 0019-Do-not-print-error-context-when-there-is-none.patch
- 0020-xmlStopParser-reset-errNo.patch
- 0021-Reuse-xmlHaltParser-where-it-makes-sense.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-apple-darwin15/ports/libxml2/2.9.2... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0003-Stop-parsing-on-entities-boundaries-errors.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0004-Cleanup-conditional-section-error-handling.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0005-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0006-Another-variation-of-overflow-in-Conditional-section.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0007-Fix-an-error-in-previous-Conditional-section-patch.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0008-CVE-2015-8035-Fix-XZ-compression-support-loop.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0009-Updated-config.guess.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0010-Fix-parsering-short-unclosed-comment-uninitialized-access.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0011-Avoid-extra-processing-of-MarkupDecl-when-EOF.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0012-Avoid-processing-entities-after-encoding-conversion-.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0013-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDi.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0014-CVE-2015-5312-Another-entity-expansion-issue.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0015-Add-xmlHaltParser-to-stop-the-parser.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0016-Detect-incoherency-on-GROW.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0017-CVE-2015-7500-Fix-memory-access-error-due-to-incorre.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0018-CVE-2015-8242-Buffer-overead-with-HTML-parser-in-pus.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0019-Do-not-print-error-context-when-there-is-none.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0020-xmlStopParser-reset-errNo.patch... OK
Running git apply with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/patches/libxml2/0021-Reuse-xmlHaltParser-where-it-makes-sense.patch... OK
Running 'configure' for libxml2 2.9.2... OK
Running 'compile' for libxml2 2.9.2... ERROR, review '/Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2/ext/nokogiri/tmp/x86_64-apple-darwin15/ports/libxml2/2.9.2/compile.log' to see what happened. Last lines are:
========================================================================
"_gzwrite", referenced from:
_xmlGzfileWrite in libxml2.a(xmlIO.o)
"_inflate", referenced from:
_xmlNanoHTTPRead in libxml2.a(nanohttp.o)
"_inflateEnd", referenced from:
_xmlNanoHTTPFreeCtxt in libxml2.a(nanohttp.o)
"_inflateInit2_", referenced from:
_xmlNanoHTTPScanAnswer in libxml2.a(nanohttp.o)
"_libiconv", referenced from:
_xmlIconvWrapper in libxml2.a(encoding.o)
"_libiconv_close", referenced from:
_xmlFindCharEncodingHandler in libxml2.a(encoding.o)
_xmlCharEncCloseFunc in libxml2.a(encoding.o)
"_libiconv_open", referenced from:
_xmlFindCharEncodingHandler in libxml2.a(encoding.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [xmllint] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** 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.0/usr/bin/ruby
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:366:in `block in execute': Failed to complete compile task (RuntimeError)
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:337:in `chdir'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:337:in `execute'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:111:in `compile'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:150:in `cook'
from extconf.rb:289:in `block (2 levels) in process_recipe'
from extconf.rb:182:in `block in chdir_for_build'
from extconf.rb:181:in `chdir'
from extconf.rb:181:in `chdir_for_build'
from extconf.rb:288:in `block in process_recipe'
from extconf.rb:187:in `tap'
from extconf.rb:187:in `process_recipe'
from extconf.rb:478:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.7.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.7.2/gem_make.out
another error
Admins-MBP:~ admin$ sudo gem install nokogiri -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config
Password:
Building native extensions with: '--use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config'
This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.8/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160703-514-1ycei3y.rb extconf.rb --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config
Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using system libraries.
checking for libexslt... no
ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
*** 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.0/usr/bin/ruby
--help
--clean
--use-system-libraries
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-xml2-dir
--with-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-exslt-dir
--without-exslt-dir
--with-exslt-include
--without-exslt-include=${exslt-dir}/include
--with-exslt-lib
--without-exslt-lib=${exslt-dir}/lib
--with-libexslt-config
--without-libexslt-config
--with-pkg-config
--without-pkg-config
--with-pkg-config
--without-pkg-config
--with-override-variables
--without-override-variables
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.8/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.8/gem_make.out
I just had the same issue. Consider installing rbenv https://github.com/rbenv/rbenv which makes it easy to switch between installed versions of Ruby. With rbenv you can download/install almost any version of Ruby and then install the mechanize Gem.
—OR—
Run this command for CL tools:
$ xcode-select --install
You will be prompted to install tools or receive this error:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
The run these commands to install the Gem (use sudo at your own discretion):
gem update --system
gem uninstall nokogiri
echo "gem: -n/usr/local/bin" >> ~/.gemrc
sudo chown -R $(whoami):admin /usr/local
sudo gem install nokogiri -n/usr/local/bin -v '1.6.3.1' -- --with-opt-include=$(xcrun --show-sdk-path)/usr/include
sudo gem install mechanize
Mechanize requires minimum version 1.6, so Nokogiri 1.6.3.1 will work: https://github.com/sparklemotion/mechanize/blob/master/mechanize.gemspec#L56
For further issues see:
http://www.nokogiri.org/tutorials/installing_nokogiri.html
https://github.com/sparklemotion/nokogiri/issues
https://github.com/sparklemotion/mechanize/issues
I have tried sudo...
1) To verify downloads, install gpgTools.
2) Install rvm (Ruby Version Manager):
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ \curl -sSL https://get.rvm.io | bash -s stable
2) Use rvm to install your own copy of ruby (DO NOT USE SUDO):
$ rvm install 2.3.1
3) Install all the gems you want into your copy of ruby--error free (DO NOT USE SUDO):
$ gem install mechanize
If you ever use sudo when issuing any of the commands above, chop off one of your fingers. By the time you finish with one hand, you'll get the hang of it.
Related
I installed pkg-config and imagemagick:
brew install pkg-config imagemagick#6
Imagemagick version
identify -version
Version: ImageMagick 6.9.12-28 Q16 arm 2021-10-29 https://imagemagick.org
When trying to install rmagick
gem install rmagick
I get
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /opt/homebrew/lib/ruby/gems/3.0.0/gems/rmagick-4.2.3/ext/RMagick
/opt/homebrew/opt/ruby/bin/ruby -I /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0 -r ./siteconf20211112-33588-cd2c64.rb extconf.rb
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
/opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config: line 9: /pkg-config/bin/pkg-config: No such file or directory
/opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config: line 9: exec: /pkg-config/bin/pkg-config: cannot execute: No such file or directory
ERROR: Can't install RMagick 4.2.3.
Can't find the ImageMagick library or one of the dependent libraries.
Check the mkmf.log file for more detailed information.
*** 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
--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=/opt/homebrew/Cellar/ruby/3.0.2_1/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/opt/homebrew/lib/ruby/gems/3.0.0/extensions/arm64-darwin-20/3.0.0/rmagick-4.2.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /opt/homebrew/lib/ruby/gems/3.0.0/gems/rmagick-4.2.3 for inspection.
Results logged to /opt/homebrew/lib/ruby/gems/3.0.0/extensions/arm64-darwin-20/3.0.0/rmagick-4.2.3/gem_make.out
So I created a folder /opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config/bin/ containing a symbolic link
ln -s /opt/homebrew/opt/pkg-config/bin/pkg-config pkg-config
And now when trying to install rmagick I get:
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /opt/homebrew/lib/ruby/gems/3.0.0/gems/rmagick-4.2.3/ext/RMagick
/opt/homebrew/opt/ruby/bin/ruby -I /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0 -r ./siteconf20211112-33523-27c8up.rb extconf.rb
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
checking for outdated ImageMagick version (<= 6.7.7)... no
checking for clang... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/opt/homebrew/opt/imagemagick#6/bin/Magick-config reports version 6.9.12-28 Q16 is installed in /opt/homebrew/Cellar/imagemagick#6/6.9.12-28
/opt/homebrew/bin/Magick-config reports version 6.9.12-28 Q16 is installed in /opt/homebrew/Cellar/imagemagick#6/6.9.12-28
Using 6.9.12-28 Q16 from /opt/homebrew/Cellar/imagemagick#6/6.9.12-28.
checking for __GNUC__... *** 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
--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=/opt/homebrew/Cellar/ruby/3.0.2_1/bin/$(RUBY_BASE_NAME)
/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:597:in `block in try_compile'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:546:in `with_werror'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:597:in `try_compile'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:864:in `macro_defined?'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:1006:in `block in have_macro'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:971:in `block in checking_for'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:331:in `open'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:361:in `block in postpone'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:331:in `open'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:357:in `postpone'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:970:in `checking_for'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:1005:in `have_macro'
from extconf.rb:99:in `configure_compile_options'
from extconf.rb:19:in `initialize'
from extconf.rb:398:in `new'
from extconf.rb:398:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/opt/homebrew/lib/ruby/gems/3.0.0/extensions/arm64-darwin-20/3.0.0/rmagick-4.2.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /opt/homebrew/lib/ruby/gems/3.0.0/gems/rmagick-4.2.3 for inspection.
Results logged to /opt/homebrew/lib/ruby/gems/3.0.0/extensions/arm64-darwin-20/3.0.0/rmagick-4.2.3/gem_make.out
It is specified I have to install development tools so I checked if it was installed:
gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: arm64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I've been searching for a long time now and found several topics dealing with similar issues but none of them could help me...
Do you have an idea why this doesn't work ?
I'm using Mac OSX 11.6, ruby 3.0.2p107
Thanks a lot
Okay just by restarting the mac, uninstalling and reinstalling everything I managed to install rmagick v4.2.3.
Uninstall
brew uninstall pkg-config imagemagick#6
Reinstall
brew install pkg-config imagemagick#6
And installed Rmagick
gem install rmagick
I already tried to uninstall and reinstall before but without restarting the mac and the Rmagick installation was failing in the same way... So it seems that restart was needed, maybe one of the paths or environment variables needed this to be set properly for Rmagick...
I installed, and reinstalled, Nokogiri multiple times, with and without sudo, and when running bundle install I get in my console:
Fetching nokogiri 1.10.7
Installing nokogiri 1.10.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/april/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.10.7/ext/nokogiri
/home/april/.rvm/rubies/ruby-2.5.0/bin/ruby -I /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0 -r
./siteconf20200331-50466-133fhom.rb extconf.rb
checking if the C compiler accepts ... *** 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=/home/april/.rvm/rubies/ruby-2.5.0/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an
executable file. (RuntimeError)
You have to install development tools first.
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:416:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/april/.rvm/gems/ruby-2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.10.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/april/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.10.7 for inspection.
Results logged to /home/april/.rvm/gems/ruby-2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.10.7/gem_make.out
An error occurred while installing nokogiri (1.10.7), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.7'` succeeds before bundling.
In Gemfile:
activeadmin_addons was resolved to 1.6.0, which depends on
xdan-datetimepicker-rails was resolved to 2.5.4, which depends on
rails was resolved to 5.1.5, which depends on
actioncable was resolved to 5.1.5, which depends on
actionpack was resolved to 5.1.5, which depends on
actionview was resolved to 5.1.5, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri
I also tried re-installing libxml2 and libxslt and I still keep running into this issue.
I am trying to run a Rails app through Docker that is using Rails 3.2.11. The gem nokogiri is not being installed when I run bundle install.
I have this in my Gemfile:
gem 'nokogiri', '~> 1.6.8.rc2'
And this in my LOCK file:
nokogiri (1.6.8.rc2)
mini_portile2 (~> 2.1.0)
When I try running bundle install through docker, I get the following error messages:
************************************************************************
Extracting libxml2-2.9.3.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.3... OK
Running 'configure' for libxml2 2.9.3... OK
Running 'compile' for libxml2 2.9.3... ERROR, review
'/var/www/docker_example/activemodel/ruby/1.9.1/gems/nokogiri-1.6.8.rc2/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.3/compile.log'
to see what happened. Last lines are:
========================================================================
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash
/var/www/docker_example/activemodel/ruby/1.9.1/gems/nokogiri-1.6.8.rc2/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.3/libxml2-2.9.3/missing
aclocal-1.15 -I m4
/var/www/docker_example/activemodel/ruby/1.9.1/gems/nokogiri-1.6.8.rc2/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.3/libxml2-2.9.3/missing:
line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
make: *** [aclocal.m4] Error 127
========================================================================
*** 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=/usr/bin/ruby1.9.1
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/var/www/docker_example/activemodel/ruby/1.9.1/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:366:in `block
in execute': Failed to complete compile task (RuntimeError)
from /var/www/docker_example/activemodel/ruby/1.9.1/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in
`chdir'
from /var/www/docker_example/activemodel/ruby/1.9.1/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in
`execute'
from /var/www/docker_example/activemodel/ruby/1.9.1/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in
`compile'
from /var/www/docker_example/activemodel/ruby/1.9.1/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in
`cook'
from extconf.rb:288:in `block (2 levels) in process_recipe'
from extconf.rb:181:in `block in chdir_for_build'
from extconf.rb:180:in `chdir'
from extconf.rb:180:in `chdir_for_build'
from extconf.rb:287:in `block in process_recipe'
from extconf.rb:186:in `tap'
from extconf.rb:186:in `process_recipe'
from extconf.rb:477:in `<main>'
Gem files will remain installed in /var/www/docker_example/activemodel/ruby/1.9.1/gems/nokogiri-1.6.8.rc2 for
inspection.
Results logged to /var/www/docker_example/activemodel/ruby/1.9.1/gems/nokogiri-1.6.8.rc2/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.6.8.rc2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.8.rc2'` succeeds before bundling.
In Gemfile:
fog was resolved to 1.23.0, which depends on
nokogiri
I've tried modifying the Gem File a few times but it keeps resulting in Nokogiri not being installed properly.
Any help is greatly appreciated!
Make sure libxml2 is installed on your machine. Is it available to install with brew install or apt-get install depending on your OS.
Update: also if you're trying to run your app inside of docker container add libxml2 too and install nokogiri with RUN gem install nokogiri -v '1.6.8.1' in your Dockerfile
I have:
Mac OS X Yosemite 10.10.3
MacPorts (not Brew)
Ruby 2 in system (not RVM)
I want to install Nokogiri and tried:
port install nokogiri
and got:
Building native extensions. This could take a while... ERROR: Error
installing nokogiri: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r
./siteconf20150323-30174-1mqhl4i.rb extconf.rb checking if the C
compiler accepts ... yes checking if the C compiler accepts
-Wno-error=unused-command-line-argument-hard-error-in-future... no Building nokogiri using packaged libraries. checking for gzdopen() in
-lz... yes checking for iconv... yes
************************************************************************ IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.2 with the
following patches applied:
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************ Extracting libxml2-2.9.2.tar.gz into
tmp/x86_64-apple-darwin14/ports/libxml2/2.9.2... OK Running patch with
/Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... OK Running patch with
/Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch...
Running 'patch' for libxml2 2.9.2... OK Running 'configure' for
libxml2 2.9.2... OK Running 'compile' for libxml2 2.9.2... ERROR,
review
'/Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-apple-darwin14/ports/libxml2/2.9.2/compile.log'
to see what happened.
*** 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.0/usr/bin/ruby
--help --clean --use-system-libraries --enable-static
--disable-static --with-zlib-dir --without-zlib-dir
--with-zlib-include --without-zlib-include=${zlib-dir}/include
--with-zlib-lib --without-zlib-lib=${zlib-dir}/lib
--enable-cross-build --disable-cross-build
/Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in
`block in execute': Failed to complete compile task (RuntimeError)
from
/Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in
`chdir' from
/Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in
`execute' from
/Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:70:in
`compile' from
/Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:110:in
`cook' from extconf.rb:278:in `block in process_recipe' from
extconf.rb:177:in `tap' from extconf.rb:177:in `process_recipe' from
extconf.rb:475:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in
/Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2 for inspection. Results
logged to
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.6.2/gem_make.out
I tried:
gem install nokogiri -- --use-system-libraries
and got:
Building native extensions with: '--use-system-libraries' This could
take a while... ERROR: Error installing nokogiri: ERROR: Failed to
build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r
./siteconf20150323-34882-16v74a8.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... yes checking if the C compiler
accepts
-Wno-error=unused-command-line-argument-hard-error-in-future... no Building nokogiri using system libraries. checking for xmlParseDoc()
in libxml/parser.h... no checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
----- libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
-----
*** 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.0/usr/bin/ruby
--help --clean --use-system-libraries --with-zlib-dir
--without-zlib-dir --with-zlib-include
--without-zlib-include=${zlib-dir}/include --with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib --with-xml2-dir
--without-xml2-dir --with-xml2-include
--without-xml2-include=${xml2-dir}/include --with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib --with-libxml-2.0-config
--without-libxml-2.0-config --with-pkg-config --without-pkg-config
--with-xslt-dir --without-xslt-dir --with-xslt-include
--without-xslt-include=${xslt-dir}/include --with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib --with-libxslt-config
--without-libxslt-config --with-exslt-dir --without-exslt-dir
--with-exslt-include --without-exslt-include=${exslt-dir}/include
--with-exslt-lib --without-exslt-lib=${exslt-dir}/lib
--with-libexslt-config --without-libexslt-config --with-xml2lib
--without-xml2lib --with-libxml2lib --without-libxml2lib
extconf failed, exit code 1
Gem files will remain installed in
/Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2 for inspection. Results
logged to
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.6.2/gem_make.out
I tried:
port install libxml2
and got:
---> Computing dependencies for libxml2
---> Cleaning libxml2
---> Scanning binaries for linking errors
---> No broken files found.
What else I can do to install Nokogiri?
Because MacPorts (and other similar package managers) install packages in non-standard locations, it cannot automatically determine the path to libxml2. The warning in your first attempt provided information on how to resolve this:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
You said that you tried gem install nokogiri -- --use-system-libraries. The Nokogiri documentation suggests that you need to add either of the following two options:
--with-xml2-config - Path to the xml2-config binary (try which xml2-config)
--with-xml2-dir - Path to the libxml2 base installation directory
If you’ve got libxml2 and/or libxslt installed in a nonstandard place
(read as “not /opt/local, /usr/local, /usr or the standard Ruby
directories”), you can use command-line parameters to the gem install
command to grease the wheels.
gem install nokogiri -- \
--use-system-libraries \
--with-xml2-dir=/path/to/dir \
--with-xslt-dir=/path/to/dir
This page gives appropriate commands for various package managers, including MacPorts:
gem install nokogiri -- \
--with-xml2-include=/opt/local/include/libxml2 \
--with-xml2-lib=/opt/local/lib \
--with-xslt-dir=/opt/local
Check to see if Xcode is installed on your machine then run xcode-select --install in the terminal. This should do the trick and allow you to run sudo gem install rails
I am trying to install charlock holmes, nevertheless, I keep getting an error:
[root#hugovm gitlab]# gem install charlock_holmes --version '0.6.9.4'
Building native extensions. This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for main() in -licui18n... yes
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
-- tar zxvf file-5.08.tar.gz
-- ./configure --prefix=/usr/local/share/gems/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/ --disable-shared --enable-static --with-pic
-- patch -p0 < ../file-soft-check.patch
*** 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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-icu-dir
--without-icu-dir
--with-icu-include
--without-icu-include=${icu-dir}/include
--with-icu-lib
--without-icu-lib=${icu-dir}/
--with-icui18nlib
--without-icui18nlib
--with-icui18nlib
--without-icui18nlib
extconf.rb:7:in `sys': patch -p0 < ../file-soft-check.patch failed, please report issue on http://github.com/brianmario/charlock_holmes (RuntimeError)
from extconf.rb:61:in `block (2 levels) in <main>'
from extconf.rb:59:in `chdir'
from extconf.rb:59:in `block in <main>'
from extconf.rb:55:in `chdir'
from extconf.rb:55:in `<main>'
Gem files will remain installed in /usr/local/share/gems/gems/charlock_holmes-0.6.9.4 for inspection.
Results logged to /usr/local/share/gems/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/gem_make.out
I already installed libicu-devel.
Thanks
I had the exact same issue today. Tried to install gitlab on a clean fedora machine.
For me, a line in /usr/local/share/gems/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/gem_make.out pointed to mkmf.log, which is in the same directory as above log file.
There it said "patch: command not found"
sudo yum install patch
In you output I can read:
extconf.rb:7:in `sys': patch -p0 < ../file-soft-check.patch failed, please report issue on http://github.com/brianmario/charlock_holmes (RuntimeError)
So it all points to a bug. I suppose it is a good idea follow the output and created an issue there, explaining what you are trying to do and giving details of your environment.
ruby-devel is missing
yum install ruby-devel
and you'll be set :)