15

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 – mmmmmm Nov 29 '14 at 19:05
9

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.

| improve this answer | |
  • 1
    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 '19 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
| improve this answer | |
  • 2
    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
  • Very late reply, but in case others find this page: you could also try ~/.zshenv if it is not working in ~/.zshrc – TJ Luoma Feb 5 at 19:02
8

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

/var/mail/

Deleting this message did the trick...

| improve this answer | |
  • 1
    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? – bot47 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
1

In case you want to check what those mails actually are before ignoring them, you can read the mails by:

mail

and read one the emails by entering a number, e.g.:

1

and if you have fixed the problem reported by the mails (in my case, the cron jobs are failing due to renaming a folder) and feel comfortable to delete all the mails:

delete *

then quit the program:

q

as shown in following screenshot: enter image description here

| improve this answer | |
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.

| improve this answer | |

You must log in to answer this question.

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