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.

I have some shares that are mounted during login. I used Users & Groups' "Login Items" panel to do this. When I login, all of the shares pop up in their own Finder windows.

How can I keep the Finder windows from popping up at login? I've already tried checking the Hide checkbox.

share|improve this question
    
Finder can't be hidden - so it's more of finding a hidden flag in finder to suppress this. I'm looking but will point you to the Directory Utility in case you want to set up the mounts there instead. –  bmike Aug 5 '11 at 15:23

4 Answers 4

up vote 24 down vote accepted
+50

Here are two very simple solutions made possible by automation tools baked right in Mac OS X: AppleScript & Automator.

AppleScript

You can use AppleScript to make a a very simple app that will mount your shares without opening any new Finder windows.

  1. Open AppleScript Editor and put in this script:

    tell application "Finder"
        mount volume "afp://Share.local/folder" as user name "username"
    end tell
    
  2. Adapt it to your need (configure your shares)

  3. Save it as an application
  4. Add it to your login items in the "Accounts" preference pane

It may ask your password the first time, but you can save it in Keychain and won't bother you anymore.

Of course, you can mount multiple disk by adding some additional mount volume lines.

Automator

If you prefer a visual interface, you can use Automator as well.

  1. Open Automator and choose "Application"
  2. Add action "Get Specified Servers" (in the "Files & folders" section)
  3. Add your shares in the list
  4. Add action "Connect to Servers" (in the same section)
  5. Save the application
  6. Add it to your login items in the "Accounts" preference pane

Here's a screenshot of the process:

Automator Application Workflow

share|improve this answer
    
Despite being save to my keychain, the AppleScript method kept asking for credentials. The Automator method works though. The action names are "Get Specified Servers" and "Connect to Servers". –  Louis Aug 5 '11 at 22:13
    
Strange, I use the AppleScript method (not at startup, but still) and it keychain saving works. Anyway, I'm glad the Automator solution works fine for you. I updated my answer with the right actions names, thank you ! –  olivier Aug 6 '11 at 7:56
    
Thank you, oliver. –  Louis Aug 6 '11 at 15:10
    
You're welcome :) –  olivier Aug 6 '11 at 15:14
    
I added subsequent mounts (of some extra storage space on Time Capsule in a dmg) using Get Specified Finder Items and Mount Disk Image for both the volume and dmg file. First time I´d used Automator, worked a charm to prevent those Finder windows popping up at login. –  Sam Brightman Nov 6 '11 at 15:16

Have you tried instead configuring your mounts using Directory Utility. I just posted a quick how to get there here.

How can I stop OS X from automatically connecting to an NFS server on startup?

I authenticated as root, created a new empty record, dragged the share I wanted to mount silently to replace the dummy text of the new record and quit.

It figured out it was an afp share using mobile me to locate a remote mac. I certainly haven't tested this at all well in Lion - but this is the place I like to set up mounts rather than just popping them in the login items.

enter image description here

You might have to dig into the server documentation as setting up a directory (local or LDAP) can be a little tweaky and exact sequence and details count heavily whether it will work reliably.

share|improve this answer

I'm about 60% sure this is the case: Finder remembers if a volume's window was open when it was ejected. Close the window then eject it, it shouldn't open automatically the next time it's mounted. I know this works for a handful of disk images I mount at login.

Unfortunately that hide checkbox doesn't work for anything but apps. I believe that's why the instructional text specifically says "to hide an application".

share|improve this answer
    
I'm afraid that didn't work. –  Louis Jul 24 '11 at 19:05
    
Do you care if any existing Finder windows are closed too? You could use an automator action to mount the servers then add an AppleScript at the end of the workflow. If that works I can update the answer (it won't let me add returns here) –  Trev Jul 24 '11 at 21:01
    
Ehh...that's very Windows XP like. I don't even want to go there. ;) –  Louis Jul 25 '11 at 4:25
    
There's no need for AppleScript if we use Automator. But we can use AppleScript as well. Both solutions are very simple and far from being "Windows XP like". If you don't know those tools, you should take a look, they're very powerful and it's very easy to get started. You can find precision on how to solve your problem using either of those tools in my answer. –  olivier Aug 5 '11 at 15:03

In Lion, any open windows will be reopened when you next login. When you restart or shutdown, you have the option to deselect the "reopen windows when logging back in" check box. This makes Lion restart with a "relatively" clean slate.

Try deselecting that check box, and see if your problem is resolved?

share|improve this answer
    
Had no effect. The windows open as the folders are mounted. –  Louis Aug 4 '11 at 19:25
    
Resume in 10.7 (Build 11A511) doesn't always work with disk images etc.. Some applications that are resume-enabled seem to cause a volume to mount if there's edition of a file on that volume; Smultron 4 seems to achieve this. Preview seems to not achive the same. I'd like to see a question on this subject. –  Graham Perrin Aug 5 '11 at 15:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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