More flexible local Rails development with Pow
Ever since Phusion Passenger shipped in a usable version for Mac OS X, I've been using it in my local development setup in order to save myself from stopping and starting
rails server (or
script/server back in the day) for any of the five or more Rails applications I may be working on in parallel at any given time. A RubyCocoa tool called Passenger PrefPane eased the process even further by providing a simple way to manage the Rails apps that were to be made available through a local name-based virtual host like
Well, that was then and this is now. 37signals recently entered this market with a tool called Pow. Pow is based on node.js and CoffeeScript and basically simplifies the process outlined above even further.
After installing Pow (with a simple command-line such as
curl get.pow.cx | sh) you simply add your applications to the
.pow subfolder in your home directory using simple symbolic links. From that point forward your application is available at
myappname is derived from the name of the symbolic link.
Behind the scenes Pow adds a firewall rule that redirects all traffic to
localhost port 80 to Pow's own port, which means you'll likely need to disable regular Mac OS X Web Sharing for Pow to work properly. Additionally, Pow ships with a little DNS service that is made responsible for resolving its own little
.dev top-level domain by placing an appropriate file into
/etc/resolve, which is a way in 10.6 Snow Leopard to influence DNS lookups without messing with
/etc/hosts entries for your local development hosts.
One thing I did run into when I initially installed Pow on my machines was that everything was installed and started properly, yet lookups for the
.dev hostnames didn't go to the local Pow DNS service. It turned out that the internal resolved process in Mac OS X,
mDNSResponder, for some reason didn't pick up the configuration changes on the fly. While a reboot may have fixed that, it's much easier to simply kill the process in question, since it is automatically restarted through
killall -9 mDNSResponder
Using Pow makes it a piece of cake to setup all of the required instances to, for example, test rather involved OAuth2 setups with OAuth provider and consumer. You can find more about Pow including a very detailed user manual at its homepage at pow.cx.