How to automount afp volumes at startup

afpautomount

I bought a NAS to store my media files and I'd like to automount the volumes on startup. Currently I'm opening those volumes as a Login Item under System Preferences > Accounts.

This works, but it unfortunately also pops up each volume in a new Finder window on boot up. Checking the hide on the items only hides the processes, not the resulting Finder window from those processes. A solution that avoids those Finder popups would be great.

I'd like to avoid any 3rd party apps to accomplish this too.

Best Answer

I found this script from http://hints.macworld.com/article.php?story=20050215082247458, but I'll reproduce it below.

  • Open up Script Editor and paste in:
    set sfiles to "afp://user:pass@host/volume"  
    tell application "Finder"  
        mount volume sfiles   
    end tell
  • Replace sfiles with the appropriate details of your AFP volume.
  • Add appropriate other lines for the other servers you have, both above and inside the tell
  • Save this script somewhere safe and add it to the login item pane (instead of the Volumes you have there now)