4

I've referred to the following solution on stackoverflow, yet I'm still experiencing the same issue:

(Error installing mysql2: Failed to build gem native extension),

The below command referenced in the link above did not remediate the issue:

brew install mysql

Evidently, the issue persists, returning the following output:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/
    --with-sqlite3lib
    --without-sqlite3lib


Gem files will remain installed in /var/folders/fb/tvgwnxc10lq6kd5xxwcg_0nw0000gn/T/bundler20150210-28601-nw7oyi/sqlite3-1.3.10/gems/sqlite3-1.3.10 for inspection.
Results logged to /var/folders/fb/tvgwnxc10lq6kd5xxwcg_0nw0000gn/T/bundler20150210-28601-nw7oyi/sqlite3-1.3.10/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
➜  code

I would sincerely appreciate assistance. Thank you!

2
  • Are you on RHEL/Centos/Fedora? Have you tried yum install sqlite-devel?
    – jpriebe
    Commented Feb 11, 2015 at 0:43
  • Neither-I'm operating Mac OS X Yosemite. Thank you. Commented Feb 11, 2015 at 2:45

1 Answer 1

5

The following commands remediated my issue:

  1. brew unlink sqlite
  2. brew install sqlite3 --universal
  3. sudo gem install sqlite3 -- --with-sqlite3-dir=/usr/local/Cellar/sqlite/3.8.8.1

My long-time friend working in InfoSec assisted me. According to him, my SQLite3 updates were directing to the wrong bin. I hope this helps anyone experiencing the same frustrating issue. Thank you!

2
  • 1
    This worked great for me. I did sudo gem install sqlite3 -- --with-sqlite3-dir=/usr/local/Cellar/sqlite/3.8.10.2. I'm on Yosemite.
    – Max
    Commented Jul 20, 2015 at 8:12
  • You always have to check, what version you have installed with ls -l /usr/local/Cellar/sqlite/ and use the latest version folder.
    – sja
    Commented Jun 28, 2017 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.