Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I just spent the better part of the morning working through this warning. This fix is for people using Mac OS Lion. The fix above using </p> <pre><code>bundle config build.nokogiri --with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib --with-xslt-dir=/opt/local </code></pre> <p>is for Snow Leopard with libxml2 installed via MacPorts.</p> <p>With Lion, libxml2 is loaded as part of the bootstrap process. Regardless of which libxml2 Nokogiri is pointing to, the Lion system default library for libxml2 will be used at runtime. Lion uses libxml2.2.7.3 found in <code>/usr</code> (not <code>/usr/local</code>).</p> <p>As mentioned many other places, one can just ignore the warning. If, like me, the warning drives you crazy, you can do this:</p> <pre class="lang-none prettyprint-override"><code>bundle config build.nokogiri --with-xml2-dir=/usr --with-xslt-dir=/opt/local --with-iconv-dir=/opt/local </code></pre> <p>Interestingly, if you type <code>nokogiri -v</code> at the command line you will get the opposite warning:</p> <pre><code>WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8 </code></pre> <p>This suggests there is more to how libxml2 is being loaded, with Ruby and Rails using the system loaded libxml2 and the command line using libxml2 from the environment path. Anyway, this silences the error for me.</p> <p>I’ll say it again – this is only for Lion. The previous fix will work for Snow Leopard.</p> <p>This is the end of the answer. Stop reading here.</p> <hr> <p>OK, you didn’t stop reading... well...</p> <p><em>NOT RECOMMENDED!!!!!!</em></p> <p>You have been warned. You can verify that Mac OSX is loading the libxml2 library in its bootstrap by disabling libxml2 found in <code>/usr/lib</code>. Do something like copying all versions of <code>libxml2*.dylib</code> to <code>libxml2*.dylib.old</code> (on my machine this was <code>libxml2.2.7.3</code>, <code>libxml2.2</code> and <code>libxml2</code>).</p> <p>After you have done this, running Nokogiri will not produce any errors. That is because it can’t find the loaded libxml2 and will now follow the environment path, eventually finding <code>libxml2.2.7.8</code> in <code>/opt/local</code>.</p> <p>BUT you won’t be able to copy the old libxml files back. This is because the OS needs the libxml2 that was loaded in the bootstrap.</p> <p>Powering off and powering on again will brick your machine. The login screen will hang and hang and hang. Power off and power on again in single-user mode (hold <kbd>Command</kbd>-<kbd>S</kbd> while rebooting). You can watch the bootstrap occur. Low and behold, it throws an error that it can’t load libxml2 and then stops working.</p> <p>Power off and power on again. This time boot into recovery mode (either hold <kbd>Command</kbd>-<kbd>R</kbd> or hold <kbd>Option</kbd> and then select the recovery disk). In recovery mode open the terminal (<code>utilities/terminal</code>). Mount <code>/usr/lib</code> on your HD (try <code>/Volumes/Macintosh\ HD/usr/lib</code>) and copy the libxml2 files back. Reboot and all will be fine.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload