After updating to OS X 10.9 Mavericks I tried to start a Rails 3 app, but the connection to the PG database was not working. Checking on PGAdmin III, the database is still there and it works fine.
So I tried to reinstall the pg gem:
gem uninstall pg
gem install pg
But the last command doesn't succeed, and gives the following error:
Building native extensions. This could take a while... ERROR: Error
installing pg:
ERROR: Failed to build gem native extension.
/Users/XXX/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb checking for pg_config... yes Using config values from
/usr/local/bin/pg_config
* 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.
/Users/XXX/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in
`try_do': The compiler failed to generate an executable file.
(RuntimeError) You have to install development tools first. from
/Users/XXX/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:461:in
try_link0' from
/Users/XXX/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:476:in
try_link' from extconf.rb:39:in `'
I guess the problem is related to the Xcode developer tools. I updated Xcode to the latest version, but that didn't solve the problem. Do you know how to fix it?
You're right that the problem is related to the Xcode developer tools. It's not a bad idea to make sure you have all the developer tools installed (as opposed to solely installing gcc as mentioned in the previous answer):
Open up Xcode
In the application menu item "Xcode" select Open Developer Tool > More Developer Tools...
This takes you to a site with a bunch of software. Go ahead and download and install "Command Line Tools (OS X Mavericks) for Xcode - Late October 2013".
You will now be able to properly install the gem.
For anyone else coming to this issue off of a fresh install of the Postgres 9.3.0 app on Mac OS X Mavericks (i.e. you're not using homebrew for your Postgres installation) you may notice that even though you can build the pg gem you cannot run rake because of a dylib issue:
rake aborted!
dlopen(/Users/[USERNAME]/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/pg-0.15.1/lib/pg_ext.bundle, 9): Library not loaded: #loader_path/../lib/libpq.5.dylib
Referenced from: /Users/[USERNAME]/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/pg-0.15.1/lib/pg_ext.bundle
Reason: image not found - /Users/[USERNAME]/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/pg-0.15.1/lib/pg_ext.bundle
Unfortunately this is a problem with the current release version of 9.3.0 of Postgres. Winding back to a previous version will fix it for you:
uninstall the pg gem: gem uninstall pg
delete your 9.3.0 Postgres app by dragging it to the trash and emptying the trash
install version 9.2.2.0 of the Postgres app here: http://postgres-app.s3.amazonaws.com/PostgresApp-9-2-2-0.zip
reinstall the pg gem: gem install pg
*Thanks to the comment by jhiro009 on this thread for pointing me in the right direction on this last Postgres app part of the issue although the 9.2.4.3 version that he mentioned didn't work for me.
Using homebrew fixed this for me:
gem uninstall pg
brew install apple-gcc42
gem install pg
EDIT: I also manually installed "devtools"
xcode-select --install
On OS X Mavericks
sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2
gem uninstall pg; gem install pg;
works with homebrew Postgresql (9.3.1) installation and Apple Command Line Tools installed (pg 0.17.0).
None of the previous solutions worked for me (I just upgraded to Mavericks and updated XCode). Instead, I installed Postgress.app. and called
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
None of the solutions worked for me, and I didn't want to use MacPorts. Try and download the Postgres App and put it into the Application directory.
Then, specify the location of newly downloaded pg_config, which resides inside the app:
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
If you run in to missing headers problem, try specifying the include directory of the app:
gem install pg -- --with-pg-include='/Applications/Postgres.app/Contents/MacOS/include/'
If you are looking for just a quick fix, add the following to your database.yml file:
host: localhost
I had the exact problem, added that line, and now all is well.
I had luck following this post from the guys at New-Bamboo:
3 Quick Tips for Coding with OS X 10.9 Mavericks
After installing the xcode dev tools, the third step sorted everything out:
brew tap homebrew/versions && brew install apple-gcc42
brew link --force apple-gcc42
ln -nsf $(which gcc-4.2) /usr/bin/gcc-4.2
I had this problem the first time I tried to install pg. Through various trials and errors I found something that worked. Thankfully, my notes also worked when Mavericks broke everything.
Hope this helps:
Do not do any brewing.
download the enterpriseDB one-click installer, mount and run.
If it doesn't work, run it through the command line (unattended mode) and it will change the memory settings. Restart, run again.
Makes a user called postgres with the password you supply. Also installs pgadmin III.
run this in app directory:
env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-include=/Library/PostgreSQL/9.2/include/ --with-pg-lib=/Library/PostgreSQL/9.2 sudo env ARCHFLAGS='-arch i386' gem install pg/lib/
Open pgadmin3 and create a user and password for rails, then add it to config.
psql [database_name] # to check on your db. Or use pgadmin III
Related
So when I try running bundle install --without production it tells me that I am getting an error and that I need to Make sure that gem install unf_ext -v 0.0.7.2 succeeds before bundling. I have not gotten this error before while installing other gems, but only when I try and install gem stripe(which is used for receiving user payments and such).
Could someone explain what could be causing this kind of problem. All help is greatly appreciated.
Thanks,
-Aaron
EDIT
What I did to solve my problems was updating all of my gems to their current and latest version. Then when I ran bundle install --without production everything seemed to install perfectly fine after that.
This error can come across due to various reasons, so it's not easy to tell what might have really caused, preventing you from bundle install, so try the following fixes, if not worked please give more details on errors that appears :)
If the error was because of missing gmkdir, then run the following command:
brew install coreutils
If the error was due to missing C++ headers related then run the bellow command:
yum install gcc-c++
Also have a look at the developer's home page given below to check you meet all dependencies required:
unf_ext 0.0.7.2 : Unicode Normalization Form support library for CRuby
After updating to Mojave MacOS version, the ruby 'lost' the reference.
To solve
$ rvm list
In my case, the version listed was:
ruby-2.5.1 [ x86_64 ]
$ rvm use ruby-2.5.1
to change to 'current' version used
$ rvm list again
to see the current version
=> ruby-2.5.1 [ x86_64 ]
After that everything are okay running bundle install or bundle update or gem install or gem update
I just have the same problem when i try to install vagrant plugin, you need to install ruby-devel before.
Hope this help you.
I ran into this deploying to a remote box. As suggested in comments, I was able to fix it by opening a console session on the affected box and running:
gem update rails
gem install unf_ext -v '0.0.7.2'
And I was then able to deploy successfully.
I resolved this issue by upgrading bundler. Simply run:
gem install bundler
which fetches the latest bundler. Then, try running:
bundle install
I got same problem. It happens after I upgrading my macOS to newer version.
Somehows, upgrading mess up /usr/local/include. So that I removed it and run install. It worked
sudo mv /usr/local/include/ /usr/local/include.delete_me
Similar to the comment of Luke, xcode-select did the job for me. But instead of switching it to a different location, I just reverted the selected version to default, although I cannot remember to ever have changed it.
sudo xcode-select -r
After that bundle install and bundle update worked fine for me again.
I was having the exact same issue trying to install this specific gem and version as well. Turns out my VPS would run out of RAM while compiling and quit. I just killed off a few processes I could live without for a few minutes and it worked...
I solved this issue by running
sudo xcodebuild -license
I was working with docker and docker compose. similar issue arised to me. I deleted the image, removed all associated containers with the application and rebuilt the image with docker build . created the container with docker-compose up inside the working directory and it started working. this solution is specific to those using docker and docker-compose. Hope it helps someone. I am still not sure about the reason why is this happening.
this can be solved installing ruby-dev
and then gem install unf_ext -v 0.0.7.2
I ran into this issue getting
Installing unf_ext 0.0.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/jfn0296/.rvm/gems/ruby-3.0.0/gems/unf_ext-0.0.8/ext/unf_ext
/Users/jfn0296/.rvm/rubies/ruby-3.0.0/bin/ruby -I /Users/jfn0296/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0 -r
./siteconf20220120-59736-elnfu0.rb extconf.rb
checking for -lstdc++... yes
creating Makefile
current directory: /Users/jfn0296/.rvm/gems/ruby-3.0.0/gems/unf_ext-0.0.8/ext/unf_ext
make "DESTDIR=" clean
current directory: /Users/jfn0296/.rvm/gems/ruby-3.0.0/gems/unf_ext-0.0.8/ext/unf_ext
make "DESTDIR="
compiling unf.cc
make: *** [unf.o] Error 1
make failed, exit code 2
After trying many of these listed, using rvm I uninstalled and reinstalled my ruby-3.0.0 and tried bundling again and this time it worked. Did not see a solution like that here so I thought I'd share.
Not sure what happened but when I upgraded to Mavericks it says that Rails it not install. I executed the following command:
rails --version
And it said "Rails is not currently installed and run sudo gem install rails".
I run sudo gem install rails and get the following:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection.
UPDATE:
I ran the command gcc --version and got the following:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
You need to install the Command Line Developer Tools. Just open Terminal and type up a command that requires it -- for instance, git, gcc or make. Or use the following command:
$ xcode-select --install
You'll see an alert like this:
Just click Install and that's it. As of OS X 10.9, there's no longer need to install Xcode for Ruby development.
Credit for the steps and picture goes to Daniel Kehoe in his latest guide: http://railsapps.github.io/installrubyonrails-mac.html
I had the same problem which I have now been able to solve.
The problem for me was that I had updated to the latest version of Xcode through the appstore but hadn't actually opened the application to complete the install. So here's what solved it for me:
Updated Xcode
Opened Xcode application
Accepted license agreement
Installed rails
Hope it works for you too.
It wasn't working for me even when I reinstalled xcode and the command line tools for mavericks.
But after that, I just did a bundle update and, for some reason, it worked.
I think I had the same issues. I updated the xcode and open xcode to accept licence aggrement. Then it worked fine as far as I can remember.
It seems many others have had problems installing the pg gem. None of the solutions posed for others have worked for me.
I have tried to install the pg gem and postgres.app. The pg gem won't install. The first error I get is:
An error occurred while installing pg (0.17.0), and Bundler cannot continue.
Make sure that gem install pg -v '0.17.0' succeeds before bundling.
The installation advice about pointing my gem install to the config for pg fails with the following error message (which many others on this forum have encountered):
Failed to build native extensions... Results logged to /Users/melanie/.rvm/gems/ruby-1.9.3-p448/gems/pg-0.17.0/ext/gem_make.out
I don't know how to find or access this log file to search for further clues.
I also get an error message (command not found) when I try using the sudo apt-get install command. I've scoured this forum for the last 6 hours, trying each piece of advice to get pg working with my rails project.
I can't find advice about how to change a path, or specifically, what change is required. My which pg_config returns a file source. I've used that with a command to install pg using that config. It fails.
There are so many people that have had trouble with this. Many answers suggest homebrew. I've had to remove that because it threw up other issues.
Same error for me and I didn't experience it until I downloaded OS X 10.9 (Mavericks). Sigh, another OS upgrade headache.
Here's how I fixed it (with homebrew):
Install another build of Xcode Tools (typing brew update in the terminal will prompt you to update the Xcode build tools)
brew update
brew install postgresql
After that gem install pg worked for me.
If you are using Ubuntu try to install following lib file
sudo apt-get install libpq-dev
and then
gem install pg
worked for me.
I am using OS X Mavericks (version 10.9)
and when I run the above I got the following message: If builds of PostgreSQL 9 are failing and you have version 8.x installed.
So I run the following command:
ARCHFLAGS="-arch x86_64" gem install pg
and this worked for me, I hope this helps someone :)
Ok I also had this problem (psql is v 9.3.0 and ruby is v 2.1.2) and the solution that worked for me was setting the bundle config settings first:
bundle config build.pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
This answer finally helped me figure it out: https://stackoverflow.com/a/9235107/3546680
I tried everything for hours but the following finally fixed it (I'm on OS X 10.9.4):
Install Xcode command line tools (Apple Developer site)
brew uninstall postgresql
brew install postgresql
ARCHFLAGS="-arch x86_64" gem install pg
easy step
brew install postgresql
gem install pg -v 'your version'
Similarly, after installing Mavericks bundle update was throwing an error on the pg gem, which is only used on production and not locally.
I use Brew to manage my packages and postgresql was already installed, but still I was getting the 'no pg_config' error.
The fix was to just brew uninstall postgresql, then brew install postgresql. After which I was immediately able to successfully run bundle update.
I believe the “correct” answer would be to first configure PATH correctly for Postgres.app by adding the following to ~/.profile (.zshrc or ~/.zprofile if using ZSH):
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
Then open a new tab or window in terminal and install the pg gem with:
ARCHFLAGS="-arch x86_64" gem install pg
Documented here:
https://postgresapp.com/documentation/cli-tools.html
https://postgresapp.com/documentation/configuration-ruby.html
On OSX with Postgres installed in /Applications, I simply run the following command (change 0.20 & 9.4 according to your version)
gem install pg -v '0.20' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
You should have :
Building native extensions with:
'--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config'
This could take a while... Successfully installed pg-0.20.
running brew update and then brew install postgresql worked for me, I was able to run the pg gem file no problem after that.
I spent a day on this and here's how I got it fixed:
I found that global value of build.pg was set to: /opt/local/lib/postgresql91/bin/pg_config
and that was not where postgres was installed.
I fixed it with replacing the value of build.pg to:
bundle config build.pg --with-pg-config=/usr/local/Cellar/postgresql/9.4.4/bin/pg_config
which is where my postgresql installation is.
Try:
gem install pg -- --with-pg-config=`which pg_config`
Solved!
I found some lack of library for PostgreSQL on the system.
Only two steps solved it:
brew install postgresql
Then run
gem install pg
For those who are not interested to use brew.
Download PostgreSQL application.
Follow the macOS default instruction to install it.
It is advisable to run PostgreSQl.
Run gem install pg -- --with-pg-config=/path/to/postgress/in/your/applications/folder/`
For example, in my machine it is
/Applications/Postgres.app/Contents/Versions/12/bin/pg_config
i got same problem and i solved
gem update --system 3.0.6
I used to have no problems at all with ruby, gems and all related stuff. But after installing X Code Developer Tools and upgrading to Lion the gems do not install.
I get the following error for every gem. This is the message for sqlite as an example:
Building native extensions. This could take a while...
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
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
What went wrong? How to fix it?
I had to install the Command Line Tools in the latest Xcode-Version (4.3.1) and
sudo gem install rails
worked like a charm.
To install Command Line Tools, go to Xcode Preferences > Downloads or use the following command in terminal (thx #Purell):
xcode-select --install
I'm using Mavericks and Ruby 2.0.0 and I also got this error (mkmf.rb can't find header files) when installing gems. I solved this issue by creating some symbolic links in Terminal.
#First install developer tools again:
xcode-select --install
#Create symbolic link to Ruby include (updated for 10.9)
sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include
#Create symbolic link to config.h (updated for 10.9)
sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.0/Headers/ruby/config.h /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/config.h
I faced same problem while trying to install rails on my Lion. This is how i could solve it.
Install rvm
$ curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
Install osx-gcc-installer
https://github.com/kennethreitz/osx-gcc-installer
Installed new version of ruby
rvm install 1.9.3
Typed to following command to show the requirements
rvm requirements
To use an RVM installed Ruby as default, instead of the system ruby:
rvm system ; rvm gemset export system.gems ; rvm 1.9.3 ; rvm gemset import system.gems # migrate your gems
rvm alias create default 1.9.3
Installed rails:
sudo gem install rails
My Mac is now read for rails!! YAY!!
Not a direct solution to your problem, but I'd suggest using rvm to install fresh rubies and gems. That should take care of it.
While installing Rails I had the error :
can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
As i had already Xcode installed, I had just to install Command Line Tools to resolve this problem
You need to have XCode installed, it includes ruby.h as well as some other important files needed to compile other native gems.
Hello i'm sorry i can't test this answer but i would suggest to change the default search paths in your bashrc and extconf.rb since the Library files seem to be moved in Lion.
(P.S. if he wants to work with the default 1.8 Version, rvm would be an unneeded hassle)
Update to the latest version of xcode, that fixed the problem for me. Make sure xcodebuild is in your path.
running xcodebuild -version in a terminal window should output 4.2.1 (4.x at least).
After a OS-Update make sure that you do accept the X-Code license even when you have used command-line-tools before. Only then some header-files will be available. To accept the license you have to run X-Code once.
I just forgot to run it with the sudo command.
sudo gem install sqlite3
not:
gem install sqlite3
I got ruby 1.8.7 (native compiled), rails 2.3.4, OSX 10.6.2 and also sqlite3-ruby.
The error I'm getting when accessing the rails app is
NameError: uninitialized constant SQLite3::Driver::Native::Driver::API
History:
I upgraded to snow leopard by migrating my apps with a FW-cable from my old macbook to the new one. Everything was running perfectly for months, but Yesterday I needed to install watir, which was dependant on rb-appscript, which didn't build due a "wrong architecture" error in libsqlite3.dylib. I figured the build was made on the old machine, so i wanted to rebuild sqlite3-ruby:
$ sudo gem uninstall sqlite3-ruby
$ sudo gem install sqlite3-ruby
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for fdatasync() in -lrt... no
checking for sqlite3.h... yes
checking for sqlite3_open() in -lsqlite3... 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.
It seems like the sqlite3 libs are not working properly. I've tried to install macports sqlite3 (sudo port install sqlite3) and use that instead, but with same result... so i rebuild sqlite3 from scratch.. download->configure->make->make install. After that, the gem now builds perfectly, but doesn't work in rails, giving the error in the top of this article.
I'm not really sure where to go from here because I've tried the following
Rebuild sqlite3 from newest source (http://www.sqlite.org/download.html)
Reinstalled sqlite3-ruby (sudo gem uninstall sqlite3-ruby && sudo gem install sqlite3-ruby)
Used sqlite3 from macports (sudo port install sqlite3 && sudo gem install sqlite3-ruby)
Reinstalled rails (sudo gem install rails sqlite3-ruby ) and updated environment.rb to rails 2.3.5.
No avail, I still get this error:
NameError: uninitialized constant SQLite3::Driver::Native::Driver::AP
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in const_missing'
from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/lib/sqlite3/driver/native/driver.rb:76:inopen'
from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/lib/sqlite3/database.rb:76:in `initialize'
Btw, I have Xcode installed from the Snow Leopard CD.
What can i do to solve the problem?
My problem was slightly different, and in fact non of the solutions I found on-line worked.
When trying to install sqlite3-ruby after upgrading to Snow Leopard and XCode 4.0 trial, I got the message
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite3-devel'
however sqlite3 was installed, and also re-installing did not help. I already had the troub le before with 64-bit and universal versions, but that I had cleared as well.
In fact, I could work with sqlite3.
So gem install should also tell you something along these lines:
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.3.1 for inspection.
So cd to that directory and there look for extconf.rb, mine was in ./ext/sqlite3/extconf.rb
I found that ruby was checking for the the sqlite3 library using
asplode('sqlite3') unless find_library 'sqlite3', 'sqlite3_libversion_number'
So I fired up irb and checked why this didn't work:
require 'mkmf'
find_library 'sqlite3', 'sqlite3_libversion_number'
Well, in fact this works and my ruby find the library.
So why doesn't it work from the setup?
Inspecting extconf.rb closely showed the following line:
sqlite = dir_config('sqlite3', ['/usr/local', '/opt/local', '/usr'])
When I execute this in irb:
require 'mkmf'
sqlite = dir_config('sqlite3', ['/usr/local', '/opt/local', '/usr'])
find_library 'sqlite3', 'sqlite3_libversion_number'
I will surprisingly not find the library anymore. In fact I do not understand how this can be, but that's what happens.
So this is the cure:
comment out the line
sqlite = dir_config('sqlite3', ['/usr/local', '/opt/local', '/usr'])
in extconf.rb
Then from /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.3.1 I issued
sudo ruby ./setup.rb
This went through with no problems (I tried before commenting out the sqlite= line, and it did not work)
Restarted the ruby application that had the problems with sqlite.
Works fine.
Hope this will help someone.
Icecream
Thanks for the answers. Here is what i did to solve the problem:
Complete reinstall of ruby1.8.7 to /usr/local, see here: http://hivelogic.com/articles/ruby-rails-leopard
Note: readline wasn't working when recompiling ruby on my mac, so i had to build that too from scratch and make sure to add the --with-readline-dir option to configure:
./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1 --prefix=/usr/local --with-readline-dir=/usr/local
Complete reinstall of sqlite3 to /usr/local
Rebuild all gems on the system with sudo gem install XXX, including sqlite3-ruby. This is only necessary with platform specific gems, but i found it to be faster just to install everything in a oneliner:
sudo gem install gem1 gem2 ... gemN --no-ri --no-rdoc
I tried to go with ruby1.9 but everything stopped working due to broken dependencies in gems and plugins, so I wouldn't recommend switching to 1.9 unless you are up for some heavy debugging and know how to restore your old system!
Finally everything is running again!
I found some guidance on this at Don Park's blog at:
http://blog.docuverse.com/2009/09/24/installing-sqlite3-ruby-gem-on-snow-leopard/
His solution points right back to Stack Overflow at the following thread:
Snow Leopard, sqlite3-ruby
The answer about the ln command seems to have solved my problem. Hope it helps you too.
If the gem isn't building it's not because you need necessarily to rebuild sqlite3 from source, but to build the gem you will require the sqlite3 developer libraries.
On most Linux/Unix systems you can install them by doing 'sudo apt-get install sqlite3-dev', however I'm not sure how it works with Macports - but make sure you have that package. You have to make sure they're in your path or pass the dir they're in when you install the gem (see the gem's output for hints as to the options for doing that).
I have sqlite3 running on my Mac just fine, both with 1.8.7 and now my updated 1.9.1 Ruby. You might want to make sure you have the XCode Developer Tools installed as well.
For those on Snow Leopard 64 and having this issue installing this macport fixed the issue for me.
sudo port install rb-sqlite3 +universal