Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Sqlite3 on Mac OS X Lion

Tags:

sqlite

macos

I am having a hell of a time getting SQLite3 installed. I have gotten all the latest stuff in terms of Ruby and Rails, the gems, etc. Everything says "Nothing to update". But when I try to install the DB I have the following error:

Building native extensions.  This could take a while... 
ERROR:  Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb mkmf.rb can't find header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out
like image 759
Matt Avatar asked Oct 08 '11 17:10

Matt


3 Answers

If you're on a version of MacOS with sqlite3 preinstalled, i.e. any modern version, then as other answers point out you can install/upgrade to the latest version using Homebrew:

brew install sqlite3

- or -

brew upgrade sqlite3

But, if you then run sqlite3 you'll see it's still using the preinstalled version by default.

To use the version installed by Homebrew, you need to update your PATH to point to it, by adding the following to .bash_profile:

export PATH="/usr/local/opt/sqlite/bin:$PATH"

Running sqlite3 should now show the latest version running.

like image 75
davnicwil Avatar answered Oct 02 '22 22:10

davnicwil


Did you have SQLite3 installed in system?

If you're using MacPorts:

sudo port install sqlite3

or Brew:

brew install sqlite3
like image 29
Oleksandr Skrypnyk Avatar answered Oct 02 '22 23:10

Oleksandr Skrypnyk


In order to install sqlite3 on Mac using brew, you can simply run:

$ brew install sqlite3

Probably, you have already installed sqlite3 because by default it comes installed since Mac OSX 10.4 onwards. In this case, you can update sqlite3 using brew by running the following command:

$ brew upgrade sqlite3
like image 38
lmiguelvargasf Avatar answered Oct 02 '22 23:10

lmiguelvargasf