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 Answers
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
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– TetsujinCommented Jan 22, 2015 at 7:56
-
1@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 Commented Jan 23, 2015 at 3:38
-
Unfortunately this didn't do it for me, feels like the right idea though Commented Jan 23, 2015 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.– KentCommented Jan 23, 2015 at 4:31
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.