32

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.

1
  • 1
    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
    Commented Aug 5, 2011 at 15:23

4 Answers 4

47
+50

Here are two very simple solutions made possible by automation tools baked right in Mac OS X, AppleScript and 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

3
  • 1
    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
    Commented Aug 6, 2011 at 7:56
  • 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. Commented Nov 6, 2011 at 15:16
  • If you try running the Automator script and get: "Connect to Servers failed" - "Failed to connect to server"; it probably means your volumes have already been mounted and can't be mounted again. If you want to test your script, go and unmount all your shares first and then try running the Automator script again.
    – Toland H
    Commented Jan 19, 2014 at 8:28
1

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.

-1

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".

4
  • I'm afraid that didn't work. Commented Jul 24, 2011 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) Commented Jul 24, 2011 at 21:01
  • 1
    Ehh...that's very Windows XP like. I don't even want to go there. ;) Commented Jul 25, 2011 at 4:25
  • 1
    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
    Commented Aug 5, 2011 at 15:03
-1

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?

2
  • 1
    Had no effect. The windows open as the folders are mounted. Commented Aug 4, 2011 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. Commented Aug 5, 2011 at 15:20

You must log in to answer this question.

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