OSX Leopard sqlite-ruby and sqlite2
on November 18, 2007 @ 12:07 PM
OSX Leopard comes with sqlite3 and sqlite3-ruby pre-installed. If you need to install the sqlite-ruby gem for sqlite2 you’ll find that it fails to install by itself.
Here’s what you’ll probably get:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
zdennis@elijah:>sudo gem install sqlite-ruby
Select which gem to install for your platform (universal-darwin9.0)
1. sqlite-ruby 2.2.3 (ruby)
2. sqlite-ruby 2.2.3 (mswin32)
3. sqlite-ruby 2.2.2 (ruby)
4. sqlite-ruby 2.2.2 (mswin32)
5. Skip this gem
6. Cancel installation
> 1
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.
ruby extconf.rb install sqlite-ruby
checking for main() in -lsqlite... no
checking for sqlite.h... no
*** 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/1.8/usr/bin/ruby
--with-sqlite-dir
--without-sqlite-dir
--with-sqlite-include
--without-sqlite-include=${sqlite-dir}/include
--with-sqlite-lib
--without-sqlite-lib=${sqlite-dir}/lib
--with-sqlitelib
--without-sqlitelib
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite-ruby-2.2.3 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/sqlite-ruby-2.2.3/ext/gem_make.out |
If you become root and attempt to do the install it will also fail.
Installing with sqlite2 from ports
I have MacPorts installed and you’ll want to make sure sqlite2 is installed:
zdennis@elijah: sudo port install sqlite2 |
Now to install sqlite-ruby:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# run the command as root zdennis@elijah: sudo su sh-3.2# ARCHFLAGS="-arch i386" gem install sqlite-ruby -- --with-sqlite-include=/opt/local/include/ --with-sqlite-lib=/opt/local/lib/ Select which gem to install for your platform (universal-darwin9.0) 1. sqlite-ruby 2.2.3 (ruby) 2. sqlite-ruby 2.2.3 (mswin32) 3. sqlite-ruby 2.2.2 (ruby) 4. sqlite-ruby 2.2.2 (mswin32) 5. Skip this gem 6. Cancel installation > 1 Building native extensions. This could take a while... Successfully installed sqlite-ruby-2.2.3 Installing ri documentation for sqlite-ruby-2.2.3... Installing RDoc documentation for sqlite-ruby-2.2.3... |
That’s it. Now it works:
1 2 3 4 5 6 |
zdennis@elijah: irb irb(main):001:0> require 'rubygems' => false irb(main):002:0> require 'sqlite' => true irb(main):003:0> |



0 comments
Jump to comment form | comments rss [?]