Pow, meet rbenv

I just ran into a problem with Pow when using rbenv for Ruby version management whereby Rails apps were not launching properly, giving the the following error message:

Error starting application
Your Rack app raised an exception when Pow tried to run it.

Bundler::GemNotFound: Could not find ??? in any of the sources

Turns out that Pow doesn’t know anything about rbenv unless you tell it. Thomas Fuchs tweeted a solution, suggesting that you just add the following to a ~/.powconfig file:

export PATH="/Users/username/.rbenv/shims:/Users/username/.rbenv/bin:$PATH"

Kill off your Pow process (I use the Powder gem for this i.e. powder down && powder up) and all should work just fine.

I personally prefer the solution mentioned in this related Github ticket as is saves having to hardcode your home directory:

export PATH=$(rbenv root)/shims:$(rbenv root)/bin:$PATH

Happy Pow’ing.

Using both Pow and Apache on OSX Lion

I have written previously about using Pow for Ruby/Rails development. Pow is great if you are purely developing in Ruby, however I’ve recently found myself needing to edit a WordPress site.

Pow intercepts requests to port 80 by default meaning that no requests can make it through to the default Apache installation on OSX. I’ve found the best way around this is to disable Pow whenever developing in PHP. The powder gem handles this nicely, so:

gem install powder

Now you can now disable Pow with the following, therefore letting requests through to Apache (assuming you have it enabled):

powder down

And once you’re done with the PHP development, enable it again with:

powder up

As a side note, I usually leave Apache disabled by default i.e. uncheck “Web Sharing” within the “Sharing” section of System Preferences until I am going to be doing some PHP development.

Hope this saves someone some time figuring out how to disable/enable Pow.

Using Pow when developing Rails applications on OSX

I heard about Pow a while ago which is “a zero-config Rack server for Mac OS X” but never got around to giving it a go. I’ve just installed it and can instantly see that it is going to make developing with Rails (or any Rack app) a whole lot nicer, especially when dealing with apps that use subdomain account keys.

If you’ve not tried it yet, head over to the Pow website and get it installed with:

curl get.pow.cx | sh

Happy new year everyone!