Low End Mac Reader Specials

Memory To Go Special: MacPro 8 Core 8GB kit $232 / 4GB kit $116 / 2GB kit $72. New Macbook 2GB DDR3-$65. HARD DRIVES available -- Free shipping / LIfetime warranty.

Download Typestyler, still the Ultimate Styling Tool for Internet, Print and Video Graphics. Works great in Classic with a Native OS X Version on the way. Free Tryout: www.typestyler.com

LA Computer Company: Specials on AppleCare, iMac's, MacBook Pros and more. Optical Drives for Apple iBooks, Powerbooks, MacBooks, MacBook Pros in Stock. Call 1-800-941-7654 Click Here.

OWC: Premium Memory for Mac without the Premium Price. DDR2 4GB from $47.99, DDR3 4GB for Unibody $79.99, Mac Pro 4GB $97.99. Expert Support, Free Installation Videos & Guides. www.MacSales.com

Poker Mac Don't install Parallels to play poker online! Poker Mac will show you how to download and install a native Mac poker application such as Full Tilt Poker Mac.

Laptop Hardware Provided by TechRestore - Overnight Mac & iPod Repairs.

Compare products like desktop computers, apple laptops, apple macs, and LCD Monitors side by side! All the information and reviews to make the best purchasing decision for new mobile phones, sat nav systems, or MP3 players. The Ciao online shopping community makes searching products easy for you.

Linux to Mac

Installing Ruby on Rails and PostgreSQL on Leopard

- 2008.02.15 - Tip Jar

Popularity: LEMLEMLEMLEMLEM

del.icio.us Bookmark in del.icio.us

Setting up a development environment with Ruby on Rails and the PostgreSQL database on Leopard is straightforward. In an interesting twist, the hard part of setting up Rails and PostgreSQL on OS X 10.5 "Leopard" is easy with Linux, and the easy part is hard with Linux.

Rails, the Easy Part

If you haven't heard, Ruby on Rails is a web development framework created by David Heinemeier Hansson that uses the Model-View-Controller (MVC) design pattern for separating business logic from the presentation details. The MVC approach is very popular in enterprise class systems.

Apple recognized the momentum behind Rails and includes a basic configuration by default. The Ruby language (1.8.6) is installed along with the Rails (1.2.3) framework. In addition to the Ruby language and Rails, OS X Leopard includes a number of useful supporting packages (called Ruby Gems). This saves you the setup time for the basic infrastructure that is required on most Linux distributions.

PostgreSQL, the Hard Part

In order to get the PostgreSQL database up and running on Leopard, use MacPorts to install it. To use MacPorts, you first need to install the X-code tools from the Leopard DVD. It's an optional install, but you need the compiler and supporting libraries to compile and install PostgreSQL. (Most Linux distributions have precompiled PostgreSQL packages ready to install with one command, making this part of the set up easier on Linux.)

Once MacPorts is installed, install PostgreSQL with:

sudo port install postgresql83

It takes quite a while for MacPorts to download and compile PostgreSQL. It took about 90 minutes for me. After it's installed, there are a couple of post install commands that need to be run so that it starts automatically at boot time. The commands are described in detail once MacPorts finishes the basic installation.

Install the Ruby PostgreSQL Driver

In a production environment, you need the latest native PostgreSQL binary driver. I tried a couple of times to install the binary driver on my iBook, but I kept getting compile errors. I got around the problem by installing the "pure ruby" driver (indicated by the -pr suffix):

sudo gem install postgres-pr

I haven't noticed a performance issue during development, but I would not feel comfortable using it for a production application.

Telling Rails to Use PostgreSQL

The final step after starting a new Rails application is to modify the "config/database.yml" file to tell Rails to use PostgreSQL. Here is an example:

development:
  adapter: postgresql
  database: keithw
  username: keithw

Having Ruby and the basic Rails environment available out of the box is a huge plus for OS X Leopard. LEM

Keith Winston is a recent Mac convert after five years of Linux on the desktop. He also writes for Linux.com and recently created CommandLineMac.com to focus on the Unix-y power of the Mac. If you find Keith's articles helpful, please consider making a donation to his tip jar.

Recent Linux to Mac Columns

Links for the Day

Recent Content on Low End Mac

Recent Deals

About LEM | Support | Usage | Privacy | Contacts


Navigation

Used Mac Dealers
Apple History
Video Cards
Email Lists

Favorite Sites

MacSurfer
MacMinute
MacInTouch
MyAppleMenu
InfoMac
Macs Only!
The Mac Observer
Accelerate Your Mac
RetroMacCast
PB Central
MacWindows
The Vintage Mac
   Museum

DealMac
DealsOnTheWeb
Mac2Sell
ramseeker
Mac Driver Museum
JAG's House
System 6 Heaven
System 7 Today
the pickle's Low-End
   Mac FAQ

Abandonware
   Petition

Mac vs. PC Info

Affiliates

The Apple Store
Mac Connection
MacMall
TechRestore
ExperCom
Crucial Memory
batteries.com

Have a question?
Ask an expert!

Advertise

Open Link