You may run into probelms like this:
Building native extensions. This could take a while...
ERROR: Error installing maxmind_geoip2:
ERROR: Failed to build gem native extension.
current directory: /Users/leonardteo/.rvm/gems/ruby-2.1.6@artstation/gems/maxmind_geoip2-0.0.8/ext/maxmind_geoip2
/Users/leonardteo/.rvm/rubies/ruby-2.1.6/bin/ruby -r ./siteconf20161227-1647-1c4uejw.rb extconf.rb
checking for maxminddb.h... no
you must have mmdb library
*** 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=/Users/leonardteo/.rvm/rubies/ruby-2.1.6/bin/ruby
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/leonardteo/.rvm/gems/ruby-2.1.6@artstation/extensions/x86_64-darwin-16/2.1.0/maxmind_geoip2-0.0.8/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/leonardteo/.rvm/gems/ruby-2.1.6@artstation/gems/maxmind_geoip2-0.0.8 for inspection.
Results logged to /Users/leonardteo/.rvm/gems/ruby-2.1.6@artstation/extensions/x86_64-darwin-16/2.1.0/maxmind_geoip2-0.0.8/gem_make.out
The solution is to:
- Install libmaxminddb. Don't install the shitty Homebrew version! Install the real deal.
$ git clone --recursive https://github.com/maxmind/libmaxminddb
$ cd libmaxminddb
$ ./bootstrap
$ ./configure
$ make
$ make check
$ sudo make install
Note that ldconfig doesn't exist on OS X.
This should have installed libmaxminddb in /usr/local/include and /usr/local/lib.
- Pass the options into the gem install.
$ gem install maxmind_geoip2 -v '0.0.8' -- --with-opt-include=/usr/local/include --with-opt-lib=/usr/local/lib
You will see the following output:
Building native extensions with: '--with-opt-include=/usr/local/include --with-opt-lib=/usr/local/lib'
This could take a while...
Successfully installed maxmind_geoip2-0.0.8
Parsing documentation for maxmind_geoip2-0.0.8
Installing ri documentation for maxmind_geoip2-0.0.8
Done installing documentation for maxmind_geoip2 after 0 seconds
1 gem installed
WOOOYEAH!
Thanks!
My 2 cents: Homebrew version is now working perfectly (tested on macOS Big Sur - version 11.1).