87

I set up a cronjob a long time ago that now doesn't exist. Whenever I open up Terminal, it now says "You have mail". I have something like 100 messages that all say the same thing. How do I mass delete all of the messages?

  • 1
    I wasn't even aware an MTA was built into OS X. Though now that I think about it, frankly I'm not surprised. – Jason Salaz Oct 21 '11 at 22:48
  • @JasonSalaz I forgot to ask you, what's an MTA? – daviesgeek Feb 1 '12 at 2:47
  • 1
    Mail Transfer Agent. When in doubt, Wikipedia. I know of, at least, MTAs, MSAs, MDAs, and MUAs. – Jason Salaz Feb 1 '12 at 4:27
168

Launch the Terminal mail app with:

$ mail

You'll see a list of all your messages. From the mail prompt, do

? delete *
? q

And that should be it. Make sure do to the q after the delete * command, that saves the changes to disk.

  • At first I didn't know what mail app mean. To anyone who is having same trouble, "It is a command". Just go type it in terminal and you will get an interactive app running there. +1 Thank you – Nabin Mar 18 '17 at 12:15
  • You can use del 1 where 1 is the message number too in case you need to keep some email for debugging purposes. – Fadli Saad Jan 27 at 7:31
9

You may also go the direct route and just run : > /var/mail/$USER to empty the mail file.

PS: Deleting the mail file requires sudo, just setting it to empty is enough.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .