Installing Sqlite3 for Ruby (Mac OSX 10.5.8)

倾然丶 夕夏残阳落幕 提交于 2019-12-06 02:58:20

If you don't already have homebrew installed, I would set that up first. It's a nice package manager and allows you to install things like sqlite with brew install sqlite.

To install brew you'll need xcode installed. If you don't already have that you'll probably need the cd that came with you system, or you can download from apple's website. On the latest OS, you can install it from the App Store which is nice (This might work for you too).

If you have mysql and would prefer to use that instead and sidestep the sqlite issue you can generate your rails project as such.

rails new my_new_project -d mysql

When you install the sqlite adapter gem, it has to compile code. To compile the code, it needs access to the sqlite development libraries.

This Rails on Mac OS X tutorial explains how to do it. Here is the most immediately relevant part:

   sudo chown -R `whoami` /usr/local #make sure we have correct permissions to install sqlite
   brew install sqlite
   gem install sqlite3

On Mac, you'll probably want to install Xcode. You will also likely need some other packages for sqlite3, which you should be able to get through MacPorts (ports: sqlite3 + rb19-sqlite3).

If you already have Xcode installed, go to the MacPorts Install page, download and install the provided .dmg. Then you should be able to run this from the console to install the necessary packages:

sudo port install sqlite3 rb19-sqlite3

You can also use Homebrew, as others have suggested.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!