Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is there some way to the make mail.app open on boot, and maintain always opened? Like a service in linux. It would be perfect if it continues to run even when not showing on Dock or on "command+tab", but still showing notifications.

share|improve this question

closed as not a real question by mankoff, bmike Feb 24 '13 at 15:32

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
    
Let's split this into two questions. How to run in the background. Can running apps (or the system) be hacked/changed to not show in the Dock or task switcher. Even if you need help synthesizing both answers into one app / workflow. Getting answers to each piece is better than chaining together these tasks. –  bmike Feb 24 '13 at 15:32
add comment

3 Answers 3

up vote 2 down vote accepted

As the other answers mentioned, you can just add it to login items:

There is a bug (?) where Mail is not hidden at login even if the hide checkbox is checked though. And it doesn't prevent you from quitting Mail manually.

You could also add this to the crontab (EDITOR=nano crontab -e):

* * * * * open -jga mail

Or using launchd, save this as ~/Library/LaunchAgents/keep_mail_open.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>keep_mail_open</string>
    <key>ProgramArguments</key>
    <array>     
        <string>open</string>
        <string>-jga</string>
        <string>mail</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StartInterval</key>
    <integer>60</integer>
</dict>
</plist>

You can load the plist with launchctl load ~/Library/LaunchAgents/keep_mail_open.plist or by logging out and back in.

This would disable ⌘Q:

defaults write -app mail NSUserKeyEquivalents -dict-add 'Quit Mail' '\0' && killall Mail

Adding <key>LSUIElement</key><true/> to an Info.plist normally hides an application from the Dock, but it also removes the menu bar. Since 10.8 some applications (apparently including Mail) crash on launch if the Info.plist is modified though.

share|improve this answer
    
Thanks, this helped me a lot! But, what does the '-j' argument does? It isn't specified in the 'man open' –  Gonzo Feb 24 '13 at 12:35
    
It's only shown in open -h, but it opens an application hidden. –  Lri Feb 24 '13 at 12:37
add comment

Either right-click or Ctrl+click on the Mail icon in the Dock, and select Options->Open at Login. To hide the icon, right-click and select Hide, or when Mail is active hit +H. Notifications should still show in the Notification Center, but clicking on one to open it may unhide Mail.app.

AFAIK, hiding an app does not remove it from the +Tab menu.

share|improve this answer
add comment

If you right click your mail icon in the dock you can choose Options > Open at Login. This way Mail will always open after a reboot / power failure. Speaking of power failure, in your system preferences under Energy Saver you have a checkbox for "Start up automatically after power failure".

I'm not aware of an option to keep your mail.app hidden from the dock when it's running.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.