Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OSX libxml2 error fix
Look like brew libxml2 and the one bundled with osx are fighting
/Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/libxml-ruby-1.1.4/lib/libxml_ruby.bundle: dlsym(0x7ffb44ee7880, Init_libxml_ruby): symbol not found - /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/libxml-ruby-1.1.4/lib/libxml_ruby.bundle (LoadError)
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/libxml-ruby-1.1.4/lib/libxml.rb:9
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require'
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require'
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `each'
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `require'
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `each'
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `require'
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.0.15/lib/bundler.rb:120:in `require'
from /Users/unixcharles/projects/teambox/config/application.rb:7
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:52:in `require'
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:52
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
from /Users/unixcharles/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:49
from script/rails:6:in `require'
from script/rails:6
This fixed it for me:
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew link libxml2
gem uninstall libxml-ruby
bundle
@pmyjavec

This comment has been minimized.

Copy link

commented Oct 6, 2011

Thank you for this, I had to rebuild the system gem also:

gem uninstall libxml-ruby
gem install libxml-ruby -v 1.1.4

You could probably remove it all together and just install it via bundler so long as no other apps are relying on it.

@unixcharles

This comment has been minimized.

Copy link
Owner Author

commented Oct 6, 2011

Glad this cloud be helpful to someone else.

That's what I did, I just removed them all

@seth-macpherson

This comment has been minimized.

Copy link

commented Apr 16, 2012

Thank you so much for this one!

@unixcharles

This comment has been minimized.

Copy link
Owner Author

commented Apr 16, 2012

No problem!

@khash

This comment has been minimized.

Copy link

commented Sep 30, 2017

If it helps anyone:

On High Sierra, I have to follow the follow to get it to work (same as the original suggestion, but note the --force)

brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew link libxml2 --force
gem uninstall libxml-ruby
bundle
@alan-andrade

This comment has been minimized.

Copy link

commented Oct 12, 2017

@khash this worked perfectly for me. Thanks a lot 👍

@erik-escobedo

This comment has been minimized.

Copy link

commented Oct 16, 2017

Yes. Thank you very much @khash

@siddhant-mohan

This comment has been minimized.

Copy link

commented Oct 20, 2017

(y)

@altuzar

This comment has been minimized.

Copy link

commented Oct 30, 2017

Worked great! Thanks @khash!

@tamalw

This comment has been minimized.

Copy link

commented Oct 31, 2017

If you don't want to link libxml2:

brew install libxml2 --with-xml2-config
gem install libxml-ruby -- --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config
bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.