Low End Mac Reader Specials
TypeStyler For Mac OS X is Now Shipping! Download The Free Fully Functional 60 Day Tryout at www.typestyler.com
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.
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: ![]()
![]()
![]()
![]()
![]()
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 created CommandLineMac 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
- Automount OS X Home Directories Using OpenLDAP and Linux, 09.28. It's possible to get an OS X Mac to automatically mount a Linux server using OpenLDAP. The tricky part is finding all the steps needed to make it work.
- Introduction to Autofs in Mac OS X, 07.01. "Autofs is often used in enterprise environments to set up network-based home directories and other network mounts for users at login."
- Automating FTP on the Mac, 03.04. There's no shortage of GUI FTP programs, but using the Terminal gives you tools to automate file transfer sessions.
- An RSS News Reader with the Power of Google, 08.20. Unlike browser-based RSS readers or dedicated news reader apps, Google Reader lets you access your favorite feeds from any computer and browser.
- More in the Linux to Mac index.
Links for the Day
- Mac of the Day: Lisa, Jan. 1983 - The ancestor of the Macintosh had a mouse, a graphical interface, and a $10,000 price tag.
- Group of the Day: Unsupported OS X is for those using OS X on unsupported hardware.
- March 22 in LEM history: 00: Macs and digital video - 01: My Performa - Fun at CompUSA75 Mac Advantages - 02: Don't try this at home - History of portable computing - 04: Prolong battery life - 05: Symantec's ravings spread FUD about OS X security - 06: Picking a Power Mac G4 - France and the end of DRM
- Support Low End Mac
Recent Content on Low End Mac
- Does iPhone OS Need Multitasking?, iCab Comes to iPhone, Canada's Proposed iPod Levy, and More, iNews Review, 03.19. Also the iPad paradox, Freescale demos $200 tablet, gardening apps, aluminum iPhone stand, steel iPhone case, and more.
- Could iPad Replace the Mac?, Mac Sales Up in 2010, Avoiding Windows 7 'Whenever Possible', and More, Mac News Review, 03.19. Also why your next Mac may be an iPad, science blogger abandons Apple, the benefits of standing while working, and more.
- The Mobile System Stampede, Lithium Battery That Can't Explode, Affordable SSD Options, and More, The 'Book Review, 03.19. Also June 2007 MacBook Pro external display issue, laptop stands, 1 TB ultraportable hard drive, Mini DisplayPort/HDMI adapter, and more.
- How to Zoom Your Browser for a More Readable Web, Steve Watkins, The Practical Mac, 03.18. Instructions for zooming text and pages in Safari, Firefox, Camino, and Opera.
- CardBus WiFi, the Shiira Browser, Ridding the Web of Flash, and Macs vs. PCs, Charles W. Moore, Miscellaneous Ramblings, 03.18. Mac longevity, Shiira speed, ambidextrous Mac and Windows use, and how Flash benefits Apple.
- How Ad Blocking Hurts Your Favorite Websites, Charles W. Moore, Miscellaneous Ramblings, 03.18. Ad income keeps the Web free. Blocking online ads hurts your favorite websites.
- Taking Apart the 12" PowerBook, John Hatchett, Recycled Computing, 03.17. There are a lot of steps involved in disassembling a 12" PowerBook. Proceed with caution.
- More links in our archive.
Recent Deals
- Best 13" MacBook & MacBook Pro Deals, 03.22. Used 1.83 GHz, $570; 2.0, $599; 2.4 GHz, $889; refurb 2.26, $849; new, $900 after rebate; Pro, $1,119 a/r, 2.53, $1,399 a/r.
- Best Power Mac G5 Deals, 03.22. 1.8 GHz single, $399; dual, $445; 2.0, $609; 2.5, $724; 2.7, $799; 2.3 GHz dual-core, $669; 2.5 GHz Quad, $799.
- Best AirPort Deals, 03.22. Refurb AirPort Express, $79; new, $95; refurb dual-band AirPort Extreme Hub, $129; new simultaneous dual-band, $168.
- Best Intel iMac Deals, 03.17. Used 17" from $600; 20" from $750; 24" from $825; refurb 21.5" nVidia, $999; new, $1,099; refurb Radeon, $1,299; new, $1,399; refurb 27" 3.06, $1,499; more.
- Best G5 iMac Deals, 03.17. 17" 2.0 GHz, $380; 1.9 GHz iSight, $479 shipped; 20" 1.8 GHz, $509 shipped; 2.1 GHz iSight, $549 shipped.
- Best Time Capsule Deals, 03.17. Close-out 500 GB, $140; new 1 TB, $279; used 2 TB simultaneous dual-band, $400; new, $455. Shipping included.
- Best iPad Deals, 03.16. 16 GB iPad, $499; 32 GB, $599; 64 GB, $699; 16 GB with 3G, $629; 32 GB 3G, $729; 64 GB 3G, $829. Free ground shipping.
- More deals in our archive.
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
B&H
MacMall
TechRestore
ExperCom
Crucial
Memory
batteries.com
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
Mac Connection
B&H
MacMall
TechRestore
ExperCom
Crucial Memory
batteries.com
