192

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?

quack quixote
  • 42,186
  • 14
  • 105
  • 129
lo_fye
  • 2,261
  • 3
  • 15
  • 10

8 Answers8

189

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
  • 25,408
  • 8
  • 67
  • 75
49

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

smottt
  • 103
  • 5
Gren
  • 1,174
  • 9
  • 9
17

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

> /var/mail/<whatever_user>

You need to include the '>'

Akhil
  • 179
  • 1
  • 2
6

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

yagooar
  • 161
  • 1
  • 4
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
  • 4,569
  • 1
  • 25
  • 34
1

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

Greenonline
  • 2,235
  • 11
  • 24
  • 30
BinaryMisfit
  • 20,643
  • 10
  • 67
  • 76
0

There is a trick way.

  1. completely empty the email file

: > /var/mail/$User

  1. change the attribute of email file

sudo chflags schg /var/mail/$User

As except "root", no one can change this file.

Then the annoying "You have mail" gone away.

-4

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

$ touch .hushlogin
Brajeshwar
  • 105
  • 1
  • 4
    This 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 Jun 21 '13 at 13:59