14

I'm using zsh with prezto as my shell with iTerm as terminal app.

I always get the message "You have new mail" when opening a new prompt. I don't have any new mail in Mac Mail and I don't run a mail server.

How can I get rid of this message?

Thanks

  • 3
    You have mail in /var/mail - use the mail command to read – user151019 Nov 29 '14 at 19:05
8

It tells you that you have received some mails (for example, because of your configuration of cron).

The best way is to read this mail. Type mail: at least one mail should appear. You can read by typing its number ID. You can also directly delete it (or even multiple mails) by typing d 1-1344 (1-1344 being the range of your new mails' IDs). Leave mail with x.

  • You may need to use q instead of x, to save changes – zessx Jul 22 '18 at 13:48
  • 1
    You slipped in an extra 1 digit. – 146438 Sep 17 at 14:10
11

Whether zsh checks for new mail can be adjusted through the MAILCHECK parameter as described in zshparam(1). It specifies the interval in seconds between checks for new mail, a zero turns off the checks completely. So just put this into your zsh configuration file:

# don't check for new mail
MAILCHECK=0
  • 1
    this doesn't work in ~/.zshrc on mac OSX with oh_my_zsh. is there another zsh configuration file? is there a work around? – Conor Cosnett Jun 13 '17 at 21:49
8

So apparently some program (probably my MAMP) put an email in

/var/mail/

Deleting this message did the trick...

  • ugh… I'd been seeing that in terminal for so long it felt like it was just its way of saying 'Hello". Nice find. – Tetsujin Nov 29 '14 at 19:56
  • 1
    So you feel like trashing the contents of your mailbox is a good idea? Do you also do this in real live? – Max Ried Dec 4 '14 at 6:53
  • 1
    Well the mail in question was more a mistake by a local server. I am on Mac OS and my mails are stored somewhere else. So trashing this file was ok. If your actual mail is stored under /var/mail YOU SHOULD NEVER DO THAT... – Øle Bjarnstroem Dec 6 '14 at 12:11
0

Unsetting (or even changing the value of) MAILCHECK didn't stop the message printed when I open a terminal tab/window. I eventually stumbled on an answer on superuser that enables me to still see this mail when it's convenient, but skip the constant nag message.

In short, create a ~/.forward file and, on a single line, the path of a file you'd like to receive mail in. Later, you can still elect to read the mail with mail -f <new_mail_file>.

If you have more advanced needs, it looks like forward can also specify a script by setting the line to |script_path or "|script_path args". I haven't tried this, but it should make it pretty simple to route messages based on the script that produced them, convert/compact them into a simple summary logline, etc.

You must log in to answer this question.

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