Simply Rails 2 OSX

Update: Read this before trying the solution below

As a result of installing the rb-sqlite3 using macports, the port command decided to install ruby amongst other things in my /opt/local/bin (As I guess they were dependancies of the rb-sqlite3) I am cool with this though,  and so I decided to install everything there and let macports control what I have installed.  So I did

sudo port install rb-rubygems


which gem and got /opt/local/bin/gem so that’s right

Then typed the following command and let gem ( the package management framework for Ruby) do its thing

sudo gem install -v=1.2.6 rails

Original Post:

I got the following error while following the instructions on page 39 of Simply Rails 2 (using my Macbook Pro OSX)

The error cam after typing the command

sudo gem install sqlite3-ruby

The error was

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

After updating the sqlite3 from source and a bunch of other things none of which got rid of the error, I decided to turn to macports

I typed

sudo port search sqlite3

and got the following output

sqlite3                        databases/sqlite3 3.6.3        an embedded SQL database engine
tcl-sqlite3                    databases/tcl-sqlite3 3.6.3        Tcl bindings for SQLite3
caml-sqlite3                   devel/caml-sqlite3 1.2.0        OCaml bindings for SQLite 3
py25-sqlite3                   python/py25-sqlite3 2.5.2        Python bindings to sqlite3
py30-sqlite3                   python/py30-sqlite3 3.0b3        Python bindings to sqlite3
rb-sqlite3                     ruby/rb-sqlite3 1.2.1        Interface to the SQLite3 DB engine from Ruby

I then decided that I would install the last one on the list rb-sqlite3

sudo ports install rb-sqlite3

This worked fine but there is a catch, macports installs stuff in /opt/local/bin as not to interfeer with the original mac software installs eg OSX comes with sqlite3 and others (a few minutes ago I was wishing it came with the interface for Ruby+Sqlite3)  but is installed at /usr/local

The trick is to add /opt/local/bin as the first path in your $PATH variable (I did this in my ~/.profile file) if you dint have one make one and put something like this in it

export PATH=/opt/local/bin:/usr/local:/usr/local/bin:/opt/subversion/bin:/usr/bin/ant/bin:$PATH


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s