This article was published on May 8th 2014 and received its last update on February 12th 2019. It takes about 3 minutes to read.
Having useful helpers at hand speeds up development and eases otherwise daunting tasks. Following these 4 simple steps does not take more than a few minutes and will make your local Rails development more productive.
This is not a tutorial — it is a guide on how to get these tools up and running as fast as possible. All of them have excellent documentation, so you really should be digging deeper to find out what else they can do for you.
Homebrew is a package manager for Mac OS X (kind of like yum
or apt-get
if you've ever been on a Linux machine). Install it along with 2 packages which will be needed for compiling Ruby versions:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew install openssl autoconf
The world is split into fans of rbenv and RVM. They both do an excellent job of letting you install different Ruby versions simultaneously and switch between them on a per-project level.
As I prefer rbenv, I recommend you install it along with ruby-build (a plugin which lets you compile and install Ruby versions with one simple command):
brew update
brew install rbenv ruby-build
Now installing Ruby 2.1.0 is as simple as rbenv install 2.1.0
. To make this version your default, use the command rbenv global 2.1.0
.
Before prematurely starting to manage your gems with the rbenv-gemset-plugin, please read my article about managing multiple Rails versions.
pow is a zero-configuration Rack server, which means that running your local Rails applications will be made ridiculously easy. Install it with curl get.pow.cx | sh
and every time you create a new Rails application, simply symlink it to your .pow-directory:
cd ~/.pow
ln -s /path/to/myapp
This will make your application available at http://myapp.dev
and http://www.myapp.dev
— without firing up Webrick or messing around with ports. If you make any changes to your app which require a restart, simply touch /path/to/myapp/tmp/restart.txt
and pow will restart this project's server before the next request.
xip.io runs a custom DNS server on the internet which provides wildcard DNS for any IP address. Sounds hacky but makes testing your app from different machines a breeze:
Assuming your local IP is 192.168.0.10, grab your iOS or Android device, make sure you're in your WLAN and access your application at http://192.168.0.10.xip.io
.
This even works with subdomains (http://subdomain.192.168.0.10.xip.io
) and natively joins forces with pow (see step 3), so you can prepend the URL with your application's name (http://subdomain.myapp.192.168.0.10.xip.io
), which makes testing multiple apps simultaneously very easy.