新安装后,SQLite3旧版本仍然存在(OS X)

时间:2010-08-11 03:34:57

标签: ruby macos unix sqlite

我在我的macbook(OS X 10.5)上安装了较新版本的SQLite3(3.7.0.1),但是'sqlite3 --version'给了我系统上的旧版本:

$ sqlite3 --version
3.4.0

我想我希望这个版本被覆盖,但似乎并非如此。任何人都能提醒我吗?我真的很感激,现在我正在尝试使用Rails,但我收到了这个错误:

$ sudo gem install sqlite3-ruby
Password:
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
checking for #include <sqlite3.h>
... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!
*** 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.

奇怪的是,自从安装新版本的sqlite3后,这个错误就消失了(换句话说,sqlite3-ruby安装成功) - 但是sqlite3仍然指向3.4.0,我检查了$ PATH中的目录它们只包含3.7.0.1

提前感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

您是否尝试过键入hash sqlite3告诉操作系统使用新操作系统?有时操作系统会记住原始版本并且不知道要刷新自己,而hash会将其戳入眼中。

否则你可能需要告诉宝石看看正确的地方。在安装程序中检查以下选项:

    --with-sqlite3-dir 
    --with-sqlite3-include 
    --with-sqlite3-lib 

答案 1 :(得分:0)

我的CentOS服务器上也遇到了同样的问题。我发现这个解决方案适合我。希望它有所帮助! http://amitava1.blogspot.com/2010/08/ruby-on-rails-on-centos-55-with.html

主要流程:

$ wget http://www.sqlite.org/sqlite-amalgamation-3.7.0.1.tar.gz
$ tar xvzf sqlite-amalgamation-3.7.0.1.tar.gz
$ cd sqlite-3.7.0.1
$ ./configure --prefix=/opt/local/sqlite-3.7.0.1
$ make
$ sudo make install
$ sudo /opt/ruby-enterprise-1.8.7-2010.02/bin/gem install sqlite3-ruby -- --with-sqlite3-dir=/opt/local/sqlite-3.7.0.1 
Building native extensions.  This could take a while...
Successfully installed sqlite3-ruby-1.3.1
1 gem installed