Ruby Forum Ruby on Rails > Can't install sqlite3-ruby gem on Mac OS X 10.5 Leopard

Posted by partydrone (Guest)
on 22.11.2007 07:36
(Received via mailing list)
I have a fresh installation of Leopard on my laptop. When I ran "sudo
gem update --system" it seemed to wipe out all of my gems. Weird. I
was able to reinstall with "sudo gem install rails --include-
dependencies" but I can't get the sqlite3-ruby gem to install.

This is what I get:

--------------------------------------------------------------------------------

bash-3.2$ sudo gem install sqlite3-ruby
Password:
Bulk updating Gem source index for: http://gems.rubyforge.org
Select which gem to install for your platform (universal-darwin9.0)
 1. sqlite3-ruby 1.2.1 (mswin32)
 2. sqlite3-ruby 1.2.1 (ruby)
 3. sqlite3-ruby 1.2.0 (mswin32)
 4. sqlite3-ruby 1.2.0 (ruby)
 5. Skip this gem
 6. Cancel installation
> 2
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 sqlite3-ruby
checking for sqlite3.h... yes
checking for sqlite3_open() in -lsqlite3... no

make
make: *** No rule to make target `ruby.h', needed by
`sqlite3_api_wrap.o'.  Stop.


Gem files will remain installed in /Library/Ruby/Gems/gems/sqlite3-
ruby-1.2.1 for inspection.
Results logged to /Library/Ruby/Gems/gems/sqlite3-ruby-1.2.1/ext/
sqlite3_api/gem_make.out
bash-3.2$

--------------------------------------------------------------------------------

I have Xcode tools installed and everything. How can I get this
working? I need to get this working as soon as I can.

Thanks.
Posted by Roberto Ruiz (artificemm)
on 05.12.2007 21:16
Hi partydrone:

Download sqlite3 source code, extract, configure with prefix /usr/local, 
make and make install.

Then run this line to set the architecture flags to your specific CPU 
and install sqlite3-ruby:


Intel:
sudo env ARCHFLAGS="-arch i386" gem install sqlite3-ruby

PPC:
sudo env ARCHFLAGS="-arch ppc" gem install sqlite3-ruby


From the list, select the newest for ruby, that would be #2.

Good luck.
Roberto