How to install Sqlite3 on Mac OS X Lion
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
Did you have SQLite3 installed in system?
If you're using MacPorts:
sudo port install sqlite3
or Brew:
brew install sqlite3
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
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.
I did not have XCode 4 installed, but version 3 instead. After installing 4 I am good to go.
精彩评论