mac gem install nokogiri error

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/angela/.rbenv/versions/1.9.3-p545/bin/ruby -r ./siteconf20170106-59264-robjdg.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.
libxml2 version 2.6.21 or later is required!
*** 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=/Users/angela/.rbenv/versions/1.9.3-p545/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

extconf failed, exit code 1

Gem files will remain installed in /Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-13/1.9.1-static/nokogiri-1.6.7.2/gem_make.out
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:89:in `run'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/ext_conf_builder.rb:36:in `block in build'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/tempfile.rb:320:in `open'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/ext_conf_builder.rb:19:in `build'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:160:in `chdir'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:160:in `block in build_extension'
<internal:prelude>:10:in `synchronize'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:159:in `build_extension'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:198:in `block in build_extensions'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:195:in `each'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:195:in `build_extensions'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:702:in `build_extensions'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:250:in `install'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/source/rubygems.rb:90:in `block in install'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/rubygems_integration.rb:130:in `preserve_paths'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/source/rubygems.rb:89:in `install'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/installer.rb:105:in `block in install_gem_from_spec'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/rubygems_integration.rb:162:in `with_build_args'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/installer.rb:104:in `install_gem_from_spec'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/installer.rb:262:in `block in install_sequentially'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/forwardable.rb:201:in `each'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/forwardable.rb:201:in `each'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/installer.rb:261:in `install_sequentially'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/installer.rb:91:in `run'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/installer.rb:15:in `install'
/Users/angela/.rbenv/rbenv.d/exec/gem-rehash/rubygems_plugin.rb:27:in `install'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/cli/install.rb:78:in `run'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/cli.rb:145:in `install'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/vendor/thor/command.rb:27:in `run'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/vendor/thor.rb:363:in `dispatch'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/vendor/thor/base.rb:440:in `start'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/cli.rb:9:in `start'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/bin/bundle:20:in `block in <top (required)>'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
/Users/angela/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.6.5/bin/bundle:18:in `<top (required)>'
/Users/angela/.rbenv/versions/1.9.3-p545/bin/bundle:23:in `load'
/Users/angela/.rbenv/versions/1.9.3-p545/bin/bundle:23:in `<main>'
An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.7.2'` succeeds before bundling.

Solutions:

brew install --force libxml2 libxslt
brew install --force libiconv

xcode-select --install

Read More: