Apple - How do I delete all Terminal mail?

Launch the UNIX mail utility by running the following at the command prompt (in e.g. Terminal.app):

$ 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.


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.


I want to reinforce clearly one point how command [delete *],[q] really helped me out in this case.

I set a cron job to run like every day in 2018 (if I recall correctly) and forgot about it.

Now I realized to check and I discovered 3000 messages in my mailbox! Note to others that a quick edit can pile up reports rapidly.

Tags:

Email

Terminal