Killing MailCatcher: Something's using port 1025

23,714

Solution 1

In OSX, run the following in a shell:

sudo lsof -nP -iTCP:1025 -sTCP:LISTEN

The expected output of this command is a process, which is listening on port 1025:

ruby    43841 youruserid    9u  IPv4 0x6a1610da80bb9b4f      0t0  TCP 127.0.0.1:1025 (LISTEN)

In the output above, the 2nd value is the process ID. Then, to kill the offending process (substitute in the correct PID):

sudo kill 43841

Solution 2

MailCatcher launches both SMTP and HTTP servers.

When you start MailCatcher in a terminal you'll see the following output:

$ mailcatcher
Starting MailCatcher
==> smtp://127.0.0.1:1025
==> http://127.0.0.1:1080
*** MailCatcher runs as a daemon by default. Go to the web interface to quit.

See the last line in the output when starting MailCatcher?

If you attempt to start MailCatcher if it's already running you'll see:

$ mailcatcher
Starting MailCatcher
~~> ERROR: Something's using port 1025. Are you already running MailCatcher?

How to quit Mailcatcher:

  1. Open the http url (http://127.0.0.1:1080) in your browser.

    Note: the port may be different than 1080. If so, you'll have to use that port. If you don't know it, you'll have to use one of the other answers here to kill the running process.

  2. In the top right corner of the page that opens, you'll see a "Quit" link.

How to Quit MailCatcher

Solution 3

If you are using linux, you should be able to see what program is using a certain port using the netstat command. To see if port 1025 is in use, run this from the command line:

$ netstat -tulpn | grep :1025

Here is a useful reference: http://www.cyberciti.biz/faq/what-process-has-open-linux-port/

Solution 4

I solved this by starting mailcatcher on a different port: mailcatcher --smtp-port 1026

And changing the following in config/development.rb

config.action_mailer.smtp_settings = {
  ...
  port: 1026,
  ...
}

Solution 5

get the process id's of the ports mailcatcher is using

lsof -i tcp:1080 
lsof -i tcp:1025

kill em:

kill 37747 
kill 35647
Share:
23,714
Admin
Author by

Admin

Updated on January 15, 2021

Comments

  • Admin
    Admin over 3 years

    I'm trying to run "foreman start" for a rails app however this error message is preventing me from running the foreman properly:

    ~~> ERROR: Something's using port 1025. Are you already running MailCatcher?

    I've tried killing the PID, going to the web interface to quit the program and also...restarting the comp. Does anybody know how to remedy this?

    Thanks

  • Admin
    Admin almost 10 years
    I've executed the command with lsof|grep :1025. Killed th e PID with kill -9 PID. However I'm still getting the error. Thanks though!
  • Mattias
    Mattias almost 9 years
    What about if the process keeps rebooting with a new PID everytime you try to kill it? Any ideas?
  • Joseph Combs
    Joseph Combs almost 9 years
    Then there is likely some other process running that is ensuring that mailcatcher is on if it is not already on.
  • Mattias
    Mattias almost 9 years
    Yeah it seems like that was the case. Also the problem for me wasn't the mail catcher process but the code sending an email, but thanks anyway!
  • Muhammad Aamir Talib
    Muhammad Aamir Talib over 8 years
    Use quit option on top right in mail catcher browser window
  • fatuhoku
    fatuhoku about 8 years
    Only this answer worked for me on Mac. Clicking 'Quit' from 127.0.0.1:1080 web interface simply didn't work for me on Mac.
  • Sasi varna kumar
    Sasi varna kumar over 7 years
    how to quit if i cannot access the http url. (running in a remote server)
  • Sasi varna kumar
    Sasi varna kumar over 7 years
    i found the answer sudo lsof -nP -iTCP:1025 -sTCP:LISTEN sudo kill <PID>
  • Nick Res
    Nick Res over 6 years
    I use the quit button and refresh the page, VIOLA it's still there running.
  • 244an
    244an about 6 years
    I'm on Windows, it doesn't help with port 1026 or 1027 etc. But it lead me in the right direction. Didn't think of just simply changing the port. It works with --smtp-port 30000 for me, Windows 7. Found it here block81.com/articles/test-emails-locally-with-mailcatcher