This article was published on May 8th 2014 and received its last update on February 12th 2019. It takes about 3 minutes to read.
4 simple steps to make Rails development on your Mac more productive
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.
Table of contents
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.
1. Install Mac OS X's missing packages with Homebrew
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
2. Use a version manager for managing and switching between different Ruby versions
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.
3. Let pow serve your application
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.
4. Test your app from different devices with xip.io
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.
Get in the loop
Join my email list to get new articles delivered straight to your inbox and discounts on my products.
No spam — guaranteed.
Got it, thanks a lot!
Please check your emails for the confirmation request I just sent you. Once you clicked the link therein, you will no longer see these signup forms.