How to Install Mailcatcher for MAMP on Mac
Nick Kulavic |

Alright, here is the skibby….I was developing a site on my local machine (I don’t know to call it a computer, mac, terminal, machine, or Jarvis…but who cares)…anyways it is a Mac, specifically OS X Yosemite and the issue that I was facing is WooCommmerce was sending out order emails from my local machine…specifically every order ever…this is a lot! I knew there would be a better way. to the rescue! Mailcatcher is a great little tool that allows you to see the mail sent from your terminal without it going to the public….”Catching it” if you will. In this tutorial I’m going to go through the process of getting this working on MAMP, note I am NOT using MAMP PRO but I bet this will work regardless.

The Steps:

  1. Open up terminal on your mac.
  2. Type sudo gem install mailcatcher 
  3. Enter your Mac password, and hit enter. This will install mailcatcher. ** You will not SEE your password entered…so don’t be alarmed.

    1. If mailcatcher fails…you need to install x-code developer tools… run this command xcode-select --install. Then run the above sudo gem install mailcatcher .
  4. Ok, you’ve made it this far….now you have mailcatcher installed, now it is time to run it. Type the command mailcatcher. This will output a success as shown below.
  5. Next, we need to open up MAMP and edit our php.ini file. To do this open up MAMP.
    1. Select your phpinfo from the opened tabs.
    2. Find the location of your active php.ini file. You can see where this is from the image.  
    3. Open the file in your text editor and search “mail function”. This should allow you to jump down to the configuration settings. You should find something like the image below. 
    4. Edit (in this case line 564) and change the smtp_port to 1025 as this is the default SMTP address for mailcatcher.
    5. Edit (in this case line 570) and remove the whole line of ;sendmail_path = and replace it with sendmail_path = /usr/bin/env catchmail -f some@from.address
      . This should look like the image below. 
    6. Save your php.ini file.
  6. Restart MAMP – the next step we need to do is to restart MAMP servers so that we load our new configuration changes. Open up MAMP and hit “Stop Servers” then hit “Start Servers” after the cycle is complete.
  7. Load your sample mail script – Next we need to load a sample script to test our setup. You can see an example of my script below. 
  8. From there we can run our script and see the results.
    1. Open up http://localhost:1080/ – This should open up the mail catcher program
    2. Run your script to see the test. This should send an email and catch it in mail catcher.
  9. You are done!

WOW we are done! Pretty easy right? Now you can set up your local machine to catch any outgoing mail so it doesn’t impact your users.

Leave a Reply