Skip to content

Instantly share code, notes, and snippets.

@sj26
Created January 19, 2012 07:41
Show Gist options
  • Star 46 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save sj26/1638617 to your computer and use it in GitHub Desktop.
Save sj26/1638617 to your computer and use it in GitHub Desktop.
Run MailCatcher in the background, always, on OS X

Place me.mailcatcher.plist into ~/Library/LaunchAgents, then run launchctl load ~/Library/LaunchAgents/me.mailcatcher.plist.

If you use pow, echo 1080 > ~/.pow/mailcatcher and go to http://mailcatcher.dev, otherwise use http://localhost:1080.

Currently pow doesn't seem to pass websockets through correctly. Looking into this.

<?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 "mailcatcher --foreground"</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
@ozzyaaron
Copy link

❤️

@bbenezech
Copy link

👍

@b2un0
Copy link

b2un0 commented Feb 13, 2014

thanks

@dasgib
Copy link

dasgib commented May 13, 2014

THX!

If you use RVM you need to install Mailcatcher into a dedicated gemset (https://github.com/sj26/mailcatcher#rvm) and maybe use the full path to the mailcatcher executable inside the .plist ("~/.rvm/bin/mailcatcher").

@sineld
Copy link

sineld commented Jan 27, 2015

Worked for me.
Thanks.

@junxy
Copy link

junxy commented Apr 30, 2015

👍

@nathanielvarona
Copy link

Replace pow with mehserve. Websockets feature works using http://mailcatcher.dev/

Checkout https://www.npmjs.com/package/mehserve

@jeremiahsmall
Copy link

Nice. Still works in 2017

@karlhepler
Copy link

Is there a reason why you are using the foreground flag? Will this still work without it?

@sj26
Copy link
Author

sj26 commented Aug 22, 2018

@oldtimeguitarguy yes it needs to run in foreground or launchd will lose track of the process and assume it failed.

@yemartin
Copy link

yemartin commented Dec 5, 2018

In case that helps anyone using chruby, here is what worked for me:

https://gist.github.com/yemartin/179369661ff880df5563a1d932329ed0

(Note: using chruby-exec did not work for some reason).

@jamesfawcett
Copy link

This is still working in 2020. Installed MailCatcha via Homebrew and worked straight out the box!

@niightly
Copy link

Guys 2021 and still up, but if for some reason some of you guys face the Load failed: 5: Input/output error (I did on Big Sur). Here is how to solve it (pretty simple actually)

  1. Run launchctl unload ~/Library/LaunchAgents/me.mailcatcher.plist
  2. Run launchctl load ~/Library/LaunchAgents/me.mailcatcher.plist

It should get things going (at least it did for me)
Btw, I just put it here for the future Me and next generations, since this Tutorial is great it should be wasted by some random mac error.

PS: Hello there future me!

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