Skip to content

Instantly share code, notes, and snippets.

@timcheadle
Last active January 31, 2017 03:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timcheadle/f54083a2a0081e8ed01218c492b49dd4 to your computer and use it in GitHub Desktop.
Save timcheadle/f54083a2a0081e8ed01218c492b49dd4 to your computer and use it in GitHub Desktop.
Run Mailcatcher with rbenv automatically in the background on OS X

Mailcatcher makes it super easy to preview emails locally for development. These instructions let you run it all the time in the background on OS X.

Note: This assumes you are using rbenv

First, install mailcatcher. Do this in your home directory because it often has gem conflicts otherwise.

cd ~ && gem install mailcatcher

Now copy the me.mailcatcher.plist file below and paste it as a launch agent:

pbpaste > ~/Library/LaunchAgents/me.mailcatcher.plist

Now load it with launchctl:

launchctl load ~/Library/LaunchAgents/me.mailcatcher.plist

Install Pow:

curl get.pow.cx | sh

Set up a Pow alias to make mailcatcher's URL easy to remember:

echo 1080 > ~/.pow/mail

Now just go to http://mail.dev and you're good to go!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>me.mailcatcher</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-i</string>
<string>-c</string>
<string>$SHELL --login -c "~/.rbenv/shims/mailcatcher --foreground"</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment