Skip to content

Instantly share code, notes, and snippets.

@koenpunt
Last active November 3, 2015 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koenpunt/834f81f10d54dbae3553 to your computer and use it in GitHub Desktop.
Save koenpunt/834f81f10d54dbae3553 to your computer and use it in GitHub Desktop.
Setup MailCatcher with rbenv and upstart

Setup MailCatcher with upstart

Clone the mailcatcher repo to a directory, here I use ~/.mailcatcher.

git clone https://github.com/sj26/mailcatcher.git ~/.mailcatcher

Navigate to the directory and setup the dependencies:

cd ~/.mailcatcher
bundle install
bundle exec rake assets

Now create the upstart configuration:

sudo tee /etc/init/mailcatcher.conf <<-EOF
start on runlevel [2345]
stop on runlevel [!2345]

respawn

env PATH='$HOME/.rbenv/shims:$HOME/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'

setuid $USER

chdir $HOME/.mailcatcher

exec bundle exec bin/mailcatcher --http-ip=0.0.0.0 --http-port=1080 --foreground
EOF

To start MailCatcher you now simply run:

sudo start mailcatcher

And it will automatically start on boot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment