thumb

Recently I discovered the following; every new Terminal window that opened under macOS showing the mysterious notice “You have mail.”. In this tutorial, you’ll learn how to manage (read, delete, etc.) the mails from this notice.

How to fix: “You have mail” in macOS Terminal app

What causes this notice

This notice message is seems to be a self explanatory, but… At first I thought that this is about emails from the Mail app, but everything was clean there. After a short web-search, it turned out that this notice was created by the console tool called “mail”, which is built into every macOS. This tool provides a functionality to send mail internally. Some apps use this functionality for various reasons.

How to manage it

Once we know what tool is creating the notice, we can use it to manage the mails. Managing the mails is a really easy process. Now, step by step guide.

Read each mail individually and delete

Viewing the content of the mail(s) may help you identify what attempted to send the mail(s).

Launch the Terminal app from the Utilities folder of your Applications folder, or use Spotlight to find it.

Type the following command to see the list of mails you’ve received:

mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/mail/arthur": 192 messages 192 unread
 U  1 MAILER-DAEMON@Arthur  Fri Oct  5 11:12  95/3814  "Undelivered Mail Returned to Sender"
 U  2 MAILER-DAEMON@Arthur  Fri Oct  5 11:12 133/5089  "Undelivered Mail Returned to Sender"
 U  3 MAILER-DAEMON@Arthur  Sat Oct  6 15:50 118/4577  "Undelivered Mail Returned to Sender"
 U  4 MAILER-DAEMON@Arthur  Fri Oct 12 08:16 100/3837  "Undelivered Mail Returned to Sender"
 U  5 MAILER-DAEMON@Arthur  Mon Oct 15 16:14 109/4202  "Undelivered Mail Returned to Sender"
 U  6 MAILER-DAEMON@Arthur  Tue Oct 16 17:58 100/3861  "Undelivered Mail Returned to Sender"
 U  7 MAILER-DAEMON@Arthur  Wed Oct 24 17:13 104/3956  "Undelivered Mail Returned to Sender"
 ...

Type t to see the content of the first mail.

You can also view a specific mail by entering its number at the ? prompt. 3, for example, will show you the contents of the third message.

You can scroll down using the “down-arrow” ( ↓ ) key. To jump to the end of the mail use the “spacebar” key.

Once you have read the mail type d to delete it, or type n to view the next mail.

When done, type q to save the changes and quit the Mail tool.

Delete all mails

Launch the Terminal app from the Utilities folder of your Applications folder, or use Spotlight to find it.

Type the following command to see the list of mails you’ve received:

mail

Type the following to delete all the mails:

d *

When done, type q to save the changes and quit the Mail tool.

Delete all mails without using the Mail tool

If you are not interested in determining the source of the mails and just want to get rid of them, it may be easier to do so without using the mail tool (which may be somewhat fiddly). Instead, you can use the following command to delete all the mails (replace the “USERNAME” with your username):

sudo rm /var/mail/USERNAME

Warning! Do not forget to replace the USERNAME with your username before pressing the Enter key.

Note! This command will prompt us to enter our computer password. Enter your password when prompted. It’s normal that the password you enter is not displayed. This is how the password is entered on the command line. Just enter your password, and then press the Enter key.

Conclusion

That’s it, you’re done. Now you have read and deleted the internal mails. So simple isn’t it?

I hope this article has helped you learn how to manage (read, delete, etc.) the internal mails that was created by the console tool called “mail”. If this article helped you then please leave a comment :smiley:

Thanks for reading!