Installing Ruby on Rails and PostgreSQL on Leopard
- 2008.02.15 - Tip Jar
Popularity: ![]()
![]()
![]()
![]()
Low End Mac Reader Specials
Memory To Go Special: MacPro 8 Core Memory 4GB kit $154 / 2GB kit $94, New 2008 iMac 2GB $46. 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.
OWC: NewerTech miniStack FireWire/USB 2.0 HD & Hub Up to 1.0TB of Performance Storage + FW/USB2 Powered Hubs - convenient & sleek 6.5" x 6.5" x 1.5" Featured: 500GB $169.99; 750GB $209.99; 1.0TB $339.99
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.
MacPro Memory 667Mhz With Apple Spec Heat Sink 2GB $90 / 4GB $134 / 8GB $264. 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
- 3 reasons to run virtualized Linux, 05.22. Reasons to run Linux under virtualization include duplicating your development environment, X11 programs that don't work well in OS X, and exploring different GUI concepts.
- 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.
- More in the Linux to Mac index.
Recent Content on Low End Mac
- Toward a better computer keyboard, Dan Knight, Mac Musings, 07.23. Today's standard computer keyboards have obsolete keys, poorly placed ones (Caps Lock), and aren't designed for the way we work today.
- The Old Mac blues, Tamara Keel, Digital Fossils, 07.23. Intel Macs are tempting, but the Power Mac 7100 will be not one more iota obsolete tomorrow than it is today.
- Best Intel iMac deals, Low End Mac Deals, 07.23. Used 17" 1.83 GHz, $699; 2.0, $800; 20" 2.16, $750; refurb 20" 2.0, $949; 2.4, $999; 2.66, $1,299; 24" 2.16, $1,199; 2.4, $1,349; 2.8, $1,549; 3.06, $1,899; more.
- Best 15" PowerBook G4 deals, Low End Mac Deals, 07.23. Used 1 GHz SuperDrive, $600; 1.25 Combo, $600; SD, $650; 1.33 Combo, $640; 1.5 SD, $675; 1.67, $730; hi-res, $800.
- Best 17" PowerBook G4 deals, Low End Mac Deals, 07.23. Used 1.33 GHz, $800; 1.5 GHz, $859; 1.67 GHz, $910.
- Mac of the Day: 17" iMac G4/800 MHz, July 2002 - The iMac 'grows up' with a 17" 1440 x 900 display.
- List of the Day: G4 'Books an email list for G4 iBooks and PowerBooks.
- July 23 in LEM history: 99: The price is right - 01: Bigger hard drives for older Power Macs - 02: Open letter to Steve Jobs about .mac - 03: The good, the bad, the stupid of BuyMusic.com - 04: The iPod goes back to basics - G3 vs. G4 iBook - 07: Why developers love programming for the Mac - Internet options for G3 Macs
- SanDisk Sansa Clip MP3 player has lots of features at a sub-shuffle price, Tommy Thomas, Welcome to Macintosh, 07.22. The Clip has 1-2 GB of storage, a screen, iPod-like navigation, excellent sound, an FM radio, a built-in microphone, and a price that beats the shuffle.
- The Apple vs. Psystar letters, Frank Fox, Stop the Noiz, 07.22. Readers weigh in on trademark law, the End User License Agreement, the right of first sale, contract law, locking software to hardware, and other issues.
- The Mac's growing market presence, Dan Knight, Mac Musings, 07.22. Apple has always been a significant player in the personal computer industry, and it's growing sales at a remarkable rate.
- Record Mac sales, $1 billion profit, and a future product transition, Dan Knight, Mac Musings, 07.22. Apple reports sales of nearly 2.5 million Macs in the past quarter, along with highest ever profits for the June quarter. And it hints at a product transition that will impact margins.
- Kensington Portable Power Outlet a great accessory for the road warrior, Charles W. Moore, 'Book Value, 07.22. With three AC outlets and two USB charging ports, this compact device is a great way to have extra power outlets when you're on the go.
- More links in our archive.
About LEM | Support | Usage | Privacy | Contacts


