Wednesday, December 26, 2007

Problem with installing Ruby 1.9 on Mac OS X 10.5 Leopard

I have tried to install Ruby 1.9 from tar ball. But so far, there is a problem and it's not successful.

I borrowed the ideas from the following sites:

"Building Ruby, Rails, Subversion, Mongrel, and MySQL on Mac OS X"

"Ruby on Rails install on 10.5 OS X"

"Trouble with Readline and Building Ruby 1.9"

(Also the same post under ruby-forum: "Trouble with Readline and Building Ruby 1.9")

Still Ruby make is failing with regard to readline.

By the way, I miss Linux package managers. It was easy to see which version of what is installed. MacPort is trying to achieve the same thing. But so far, it was not successful to install it. When it comes to package management, I think Linux is better.

Ruby 1.9 Released

You can download it from Ruby Programming Language site.

Sunday, December 23, 2007

Location of Ruby gems for the preinstalled Ruby on Mac OS X 10.5 Leopard

It's /Library/Ruby/Gems/1.8/gems/

The preinstalled Ruby is /usr/bin/ruby (note: execute "which ruby" from command line), which is a symbolic link to


So you would think that the location of the gems is under


just like when you install Ruby manually.
But when I looked at the Rails gem under the directory, it was rails-1.2.3.

I performed a search for "rails" gem under each directory under the path as a root user but all the searches found only the same rails-1.2.3.
So finally I performed a search for the entire directory tree, i.e. executed

find / -name "rails" -print

as a root user. And here it is, it found


By the way, as a side note, I wanted to see if "/Library/Ruby/Gems/1.8/gems/rails-2.0.1/bin/rails" is sym-linked from /usr/bin/rails (by executing "ls -alFh /usr/bin/rails"). But it isn't. /usr/bin/rails is not a symbolic link of anything. It's an executable file.

This whole thing is very confusing to me.
All I wanted to do was to look at the Rails 2.0.1 source code.

Thursday, December 20, 2007

Ruby on Rails 2.0 configuration files, etc.

I have read through the files in the Rails project generated with Ruby on Rails 2.0, such as the configuration files, etc. e.g. /config/boot.rb, /config/environment.rb.

I've found that they are more well-written and well-structured.

Ruby gem install error with Mac OS X 10.5 Leopard

I attempted to install ruby-debug gem but it failed with a message:

ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install ruby-debug can't find header files for ruby.

This was because the installed Mac OS X Xcode Tools was old, specifically, GCC was old. I had to install Xcode Tools 3.0, which is actually shipped with Mac OS X 10.5 Leopard DVD. You can also download it.

Thursday, December 13, 2007

Switched to TextMate

As I updated to Ruby on Rails 2.0, I decided to try out TextMate.

After getting used to it after reading its documents, I came to like it because its Ruby and Ruby on Rails Bundles seem to have lots of good features.

But I didn't necessarily like its Subversion Bundle. I had to do "svn import" from the command line, delete the local Rails directory (of course, after backing it up), and check out the directory from the Subversion. Otherwise, there is no .svn folder. With Subversion (Eclipse Subversion Plugin), you don't have to delete the local directory. Maybe there is a better way to make this work in TextMate and I would like to know it.

Sunday, December 09, 2007

Ruby MetaProgramming

Watch the video
"MetaProgramming - Extending Ruby for Fun and Profit"

Isn't this wonderful?

Updating to Ruby on Rails 2.0

Until today, I have been using Ruby I installed manually on /usr/local/ (/usr/local/bin/ruby) because that's how I installed it on Mac OS X 4 Tiger. When I purchased Mac OS X 5 Leopard several days after it was released, I noticed that Ruby was installed under /usr (/usr/bin/ruby) as a part of Mac OS X developer tools. But I kept my .profile with "export PATH=/usr/local/bin:/usr/local/sbin:$PATH" because I had lots of gems installed already under the Ruby under /usr/local (/usr/local/lib/ruby).

Today as a part of updating to Ruby on Rails 2.0, I switched to use the Ruby included with Mac OS X developer tools (under /usr). And updated Rails gem under that location (under /user):

1. Commented out "export PATH=/usr/local/bin:/usr/local/sbin:$PATH" in my .profile. Restarted the shell.

2. Executed "gem update rails".

Ruby on Rails 2.0 Released

See Ruby on Rails official site and Ruby on Rails weblog.