3

I'm running some cron jobs on my machine and every time I fire up a terminal session I'm getting a 'You have mail.' message. Any way to turn this off?

3

It's likely to be in the spool file: /var/mail/$user. Because sometimes your mailbox will contain important messages (a failed cronjob task, etc.) you don't to check it every time by yourself.

Also, you can check man mail

2

I think if you add this line to your ~/.bashrc file, the notifications will go away.

unset MAILCHECK
  • I'd think it more sensible to check what cron had to say than just ignore it all :P – Tetsujin Jan 22 '15 at 7:56
  • @Tetsujin the cron jobs produce output upon a successful run which goes into my mail folder. They also aren't vital to the point where I'd need to know immediately of errors. I'd imagine there are others in similar situations – Peter Berg Jan 23 '15 at 3:38
  • Unfortunately this didn't do it for me, feels like the right idea though – Peter Berg Jan 23 '15 at 3:39
  • @Accipheran I found an interesting post in another forum, that in OS X the message does not come from bash, but from "login". I'll add a second answer to address this. – Kent Jan 23 '15 at 4:31
1

Mac OS X runs "login" each time a login occurs. So, no matter what the setting is for Bash, the "login" will tell you about mail whenever you login.

However, if you have a ~/.hushlogin file, the login process will be quieter and (hopefully) not bother you.

Apple's man page for "login"

You must log in to answer this question.

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