Why does terminal say: "You have mail"?

131

28

Any idea why my Mac terminal says:

You have mail in /var/mail/lofye

How can I make it stop saying that every time I open terminal?

lo_fye

Posted 2009-08-19T15:04:21.727

Reputation: 1 641

Best answers are available here: http://unix.stackexchange.com/q/2432/16253

– Antonio – 2016-05-10T07:09:46.057

Answers

131

Somehow you've had a script or something similar deliver mail to your account on your local machine which is stored in /var/mail/$USER

You can either remove the file /var/mail/$USER which will remove the alert that you have mail (as it will alert you if that folder is present and/or has unread messages) or you can use mail to read the messages before deleting them.

Chealion

Posted 2009-08-19T15:04:21.727

Reputation: 22 932

How can I disable only notifications without losing emails? – Vitaly Zdanevich – 2016-12-29T09:03:42.850

http://xkcd.com/1728/ Funny because it's true :) – camelBase – 2017-01-20T05:37:00.540

11Thanks for the tip. Turns out a CRON is mailing me... 36,061 times :( Deleted with command: d 1-36061 – lo_fye – 2009-08-19T15:15:45.980

7

See this question. http://superuser.com/questions/7677/stop-cron-from-emailing-me

– Richard Hoskins – 2009-08-19T16:45:56.670

You can direct the cron output to /dev/null to avoid the mail. – Chris Nava – 2009-08-19T19:18:20.640

1Where is this default text located on Mac OS X? I'd like to leave it active but change the message. – None – 2012-01-17T21:20:28.133

15

Type mail to view the mail. I believe d deletes it.

Gren

Posted 2009-08-19T15:04:21.727

Reputation: 806

3Doing mail and then d * removed all mails for me on Mac OS X. – yagooar – 2014-11-13T13:11:43.283

1>

  • d should delete everything.
  • < – lyarwood – 2009-08-19T15:11:01.357

    3When using mailx d* will delete everything. Mail itself won't. – BinaryMisfit – 2009-08-19T15:46:07.650

    10

    There are several ways to remove it. The simplest is:

    > /var/mail/<whatever_user>
    

    You need to include the '>'

    Akhil

    Posted 2009-08-19T15:04:21.727

    Reputation: 109

    7That wipes out the received mail for that user. – vonbrand – 2013-03-31T14:33:01.263

    2

    I'm willing to bet it's because there are files in that folder.

    Have you actually looked at the contents of the folder? If there is something in there, it will more than likely give you an idea of what caused it, and how to prevent it in the future.

    From the terminal:

    cd /var/mail/lofye
    ls
    

    If you don't have mail, you won't see the message (there's not even a folder for my username under mail on my mac).

    EvilChookie

    Posted 2009-08-19T15:04:21.727

    Reputation: 4 519

    3/var/mail is a directory, and loyfe is the file within it. To view the file, one could less /var/mail/loyfe. – Thomas Hunter – 2013-06-21T13:56:58.597

    1

    Open mail and then put in d * and press Enter. The d command means delete and the * selects all mails in the list.

    yagooar

    Posted 2009-08-19T15:04:21.727

    Reputation: 111

    Welcome to SuperUser. This answer would be even better if you edit it to provide some explanation as to why your solution addresses the OPs question. – I say Reinstate Monica – 2014-11-13T14:42:44.790

    0

    If your running ClamAV for Mac this is a known issue. The system mails you after each update and scheduled scan.

    BinaryMisfit

    Posted 2009-08-19T15:04:21.727

    Reputation: 19 955

    -3

    I was able to just create a .hushlogin and I've a clean Terminal now.

    $ touch .hushlogin
    

    Brajeshwar

    Posted 2009-08-19T15:04:21.727

    Reputation: 107

    2This prevents many messages from being displayed, not just the new mail message. This could be dangerous as there are certain other warnings the user would miss out on. – Thomas Hunter – 2013-06-21T13:59:12.683