Installing Ruby on Rails and PostgreSQL on Leopard
- 2008.02.15 - Tip Jar
Low End Mac Reader Specials
Memory To Go Special: MacPro 8 Core Memory 4GB kit $192 / 2GB kit $109. MacBook Pro / MacMini / iMac Intel Core2 DUO 2GB $44 1GB $23--Free shipping available.
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: LA Computer Company: Specials on AppleCare, Apple Displays, MacBooks, iMac's, MacBook Pros, Laptop and iPod accessories and more. Apple A/C Adapters for laptops starting at $25.00 Call 1-800-941-7654 or Click Here.
OtherWorld Computing: Better than new Batteries for iPods NewerTech NuPower, up to 20+ Hours! Complete with Tools from $19.99. Online videos. Professional installation available.
Mac users can finally play Party Poker for Mac. Not only that, they can also learn how to play PokerStars for Mac.
Laptop Hardware Provided by TechRestore - Overnight Mac & iPod Repairs.
Compare products like desktop computers, laptops, and LCD TVs side by side! All the information and reviews to make the best purchasing decision for a new cell phone GPS products or MP3 players. The Ciao network makes searching products easy for you.
Memory For New Intel Core2 DUO MacBooks, MacBook Pro, MacMini & iMacs" 4GB Kit $80, 3GB Kit $60, 2GB Kit $40, 1GB $20. Click to Maximize your Macs...
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.
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
- Taking Linux to Mac OS X with virtualization, 03.17. Thanks to products like VMware Fusion, it's easy to run your favorite Linux distro alongside Mac OS X.
- Restore stability to a troubled Mac with a clean system install, 01.15. If your Mac is misbehaving, the best fix just might be a fresh reinstallation of Mac OS X - don't forget to backup first.
- Moving data from Linux to the Mac, 12.17. When switching operating systems, the best advice is to use standard cross-platform file formats whenever possible.
- More in the Linux to Mac index.
Recent Content on Low End Mac
- 10 cult Macs adored by collectors, Tamara Keel, Digital Fossils, 05.13. Macs are not only noted for their longevity, but also by the passion which collectors have for some of the most interesting models ever made.
- Low End Mac's Compleat Guide to the Lombard PowerBook G3, Charles W. Moore, 'Book Value, 05.13. With the Lombard PowerBook, Apple abandoned the legacy ADB and serial ports for USB, trimmed 20% from WallStreet's weight, and hit 400 MHz.
- Best PowerBook G3 deals, Low End Mac Deals, 05.13. Used 14" WallStreet G3/266 MHz, $90; Lombard G3/400 MHz, $200; Pismo G3/400 MHz, $300; 500 MHz, $350.
- Best Apple TV deals, Low End Mac Deals, 05.13. Refurb 40 GB Apple TV, $199; new, $210; refurb 160 GB, $279; new, $319.
- Best Xserve deals, Low End Mac Deals, 05.13. Used 1 GHz dual G4, $1,399; close-out 2.0 dual-core Xeon, $1,999; refurb 2.66, $2,799; 3.0, $3,499; new 2.8 GHz quad, $2,888; 8-core, $3,299; 3.0, $4,059.
- Mac of the Day: Classic II/Performa 200, Oct. 1991 - The last b&w compact Mac put a 16 MHz 32-bit CPU on a 16-bit bus.
- List of the Day: Apple2list supports Apple II users.
- May 13 in LEM history: 99: Cost effective upgrades for 68030s - 02: Free POP3 email - Penguin lockup mystery - 03: Safari and the Internet experience - Niners to Xers: Apple's Switch campaign for Mac users - 05: Xbox 360 specs put Power Mac G5 to shame - Which older Macs are good candidates for Tiger? - Tiger on an iBook - Does Mac mini kill the used Mac market?
- Free Time Machine Editor does one thing and does it well, Alan Zisman, Zis Mac, 05.12. If Time Machine's habit of backing up every hour is impacting your work flow, this free utility gives you control options that Apple didn't build into Time Machine.
- Low End Mac's Compleat Guide to Mac OS 9, 2008 edition, Charles W. Moore, Miscellaneous Ramblings, 05.12. Declared dead by Steve Jobs 6 years ago, Mac OS 9 remains fast and stable, but Classic software hasn't kept up with Web changes. What Macs support OS 9, where to buy it, and how to update it.
- Value of old Power Macs, old computers in school, Panther or Tiger on Pismo, and more, Dan Knight, Low End Mac Mailbag, 05.12. Also new 20" Penry iMac vs. 24" Santa Rosa and great results with a low-cost external SuperDrive.
- From Mac tinkerer to full time Mac user, Mike Tessitore, My Turn, 05.12. It started with buying old Macs on eBay and tinkering with them. But when the Windows PC died, the author learned that Macs could do everything he needed.
- More links in our archive.
About LEM | Support | Usage | Privacy | Contacts


