Bilal Wahla
Bilal Wahla

Reputation: 665

sqlite3 gem on Mac OS X Lion... fail!

I just upgraded my Mac to Lion but unfortunately I had to re-setup my Rails development environment. With the following versions of software:

ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0] Rails 3.0.9 sqlite3 3.7.5

When I run the command: sudo gem install sqlite3

It throws following exception:

ERROR:  Error installing sqlite3:
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

And the it adds:

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out

Did anyone dive into Lion yet..

Thanks

Upvotes: 3

Views: 6669

Answers (8)

dgcupps
dgcupps

Reputation: 39

Installing Xcode didn't do the trick for me. Instead, I installed Homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"

Then installed sqlite with Homebrew:

brew install sqlite

And then finally ran:

sudo bundle install

within my Rails app, which successfully installed Sqlite

Upvotes: 3

oozzal
oozzal

Reputation: 2451

For those still having issues installing sqlite3 gem in Mavericks:

sudo xcode-select --reset

xcode-select manual says, the reset option Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism.

By the way, this happened to me while migrating from Snow Leopard to Mavericks. I think the issue was with the developers tool path, which is different in each of these operating systems.

Upvotes: 0

user2281046
user2281046

Reputation: 1

I just upgraded to Maverick and had trouble with a few gems. Go to Apple Developer Downloads and pickup Command Line Tools (OSX Mavericks) for Xcode. After installation, I was able to bundle sqlite3 and pg gems.

Upvotes: 0

David
David

Reputation: 61

I had this problem too and realised installing XCode is not enough, following installation you need to go into XCode -> Preferences -> Download, and install the Command Line Tools. This installs GCC.

Upvotes: 6

David P
David P

Reputation: 1

If upgrading to Lion, the first thing I would recommend is downloading and INSTALLING the new Xcode (4.2) from the Apple website. I know this is in regards to rails, but I like having Xcode for messing with Iphone and Ipad applications (granted I'm not very good at it...yet).

Then, you will want to download the GCC installer:

github.com/kennethreitz/osx-gcc-installer/downloads. Download the latest one.

This is somewhat of a replacement for Xcode and it will tell you that you can uninstall Xcode after this install is finished. That's up to you: I did not uninstall Xcode afterwards.

To test it out if it made an impact, I created a rails new appname in my terminal. The bundle worked fine, before it did not. There was an issue with gem install json -v '1.6.5'

Fwiw I'm currently in Chapter 9 of the Hartl tutorial and was working in rails 3.1, Snow Leopard OS X Before today.

Hope this helps!

Upvotes: 0

Julian Ray
Julian Ray

Reputation: 61

I was having problems with this. I downloaded the Xcode from Apps store and it still didn't work. I reinstalled Xcode 3.2 and still nothing. Then I read a post that said that downloading Xcode and installing it were different. I went the Applications and ran the Xcode installer and after that everything worked fine.

Upvotes: 6

Bilal Wahla
Bilal Wahla

Reputation: 665

updated Xcode for Mac OS X Lion and sqlite3 gem installed without any trouble... So I think whenever anyone upgrades their Mac OS, the first thing they should do is update Xcode after the upgrade...

Upvotes: 2

Chris Ledet
Chris Ledet

Reputation: 11628

I've always had problems with OS X's built in Ruby. Use RVM. Helps Ruby devs manage their Ruby versions and libraries. Definitely recommended. Then from there, install your gems.

Install Guide: http://beginrescueend.com/rvm/install/

Edit: You won't even need to sudo anymore since everything is in your home directory hidden.

Upvotes: 3

Related Questions