You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I *RELIABLY* get my Mac to connect to a network drive *AUTOMATICALLY* on login?

I need this stupid computer to connect to a network share AUTOMATICALLY when I log in. WHY CAN I NOT MAKE THIS HAPPEN?!!


I've tried a DOZEN different things. From adding the folder to the Login Items to writing a script that tries to tell finder to open the folder's alias. NOTHING WORKS!!! I *ALWAYS* get some kind of "cannot find networked computer" or "cannot find folder" error.


The *ONLY* way I can get it to work EVERY TIME is to place an ALIAS to the network folder on my desktop and double-click on that alias MANUALLY after I log in. BUT THAT'S NOT AUTOMATIC!!!!! HOW DO I MAKE THAT HAPPEN AUTOMATICALLY WHEN I LOG IN?!!!!!


HOW CAN WINDOWS DO THIS, BUT A MAC CANNOT?!!!


Posted on Feb 5, 2023 5:27 PM

Reply
Question marked as Top-ranking reply

Posted on Feb 6, 2023 8:59 AM

FINALLY FIGURED IT OUT!!!!


God, Apple, y'all could make this easier!!! In Windows you "Map a network drive" and then there's a checkbox that says "restore mapped drive on login." EASY PEASY. But, NOOOOOOO, you have to be DIFFICULT!!!


I love my Mac, but y'all make some STUPID DECISIONS sometimes!! (Don't get me started on how y'all RESET all the default programs every single time I have to update MacOS!!! Talk about a STUPID DECISION!!!)


Anyway -- here's how to do it:


-- Open Script Editor


-- Paste the following code into the Script window:

delay 15
do shell script "open smb://username:password@servername/sharedfolder"

(obviously, change the username, password, servername, and sharedfolder to match your setup.)


-- Run it first by pressing the "play" button at the top of the Script Editor window. Gotta make sure it works before you save it.


-- Save it as an Application (NOT as a Script!!) to your Applications folder. Call it whatever you want. I call mine "MountShareDrive" (no spaces). I highly recommend you *don't* use spaces, because if you ever need to use this app in a script, you'll regret having spaces in the name.


-- In System Settings | General | Login Items, click on the + in the Open At Login list and browse to your Applications folder. Double-click on your newly-created application to add it to your Login Items list.


Next time you reboot, it'll login to your network share 15 seconds after you log in. The "delay 15" line is what finally fixed my problem. The Mac apparently takes a few seconds to query the network as to the names of all the local devices it can see. Simply having the "open smb://blah-blah-blah" command with no delay will cause it to fail (as it was failing for me) with a "cannot find 'servername'" error. (And, of course, as soon as I manually ran that "open smb://blah-blah-blah" command, it'd work fine. Because it had been long enough since login for the Mac to know the names of the local devices.). If you still get "server unknown" errors, just increase the delay. Maybe your network (or the shared devices) are slower to respond than mine are. And of course, make sure you can actually connect to the device manually, before you try to do this via a login script.


Again, Apple, y'all could make this A LOT EASIER!!! Ridiculous!!!! MacOS is supposed to be the BETTER alternative to Windows. This kind of stuff *REALLY* makes Windows look better. Ugh! I'm an advanced user and it took me TWO DAYS to figure it out. UNACCEPTABLE!!!!


Similar questions

3 replies
Question marked as Top-ranking reply

Feb 6, 2023 8:59 AM in response to Laurence5905

FINALLY FIGURED IT OUT!!!!


God, Apple, y'all could make this easier!!! In Windows you "Map a network drive" and then there's a checkbox that says "restore mapped drive on login." EASY PEASY. But, NOOOOOOO, you have to be DIFFICULT!!!


I love my Mac, but y'all make some STUPID DECISIONS sometimes!! (Don't get me started on how y'all RESET all the default programs every single time I have to update MacOS!!! Talk about a STUPID DECISION!!!)


Anyway -- here's how to do it:


-- Open Script Editor


-- Paste the following code into the Script window:

delay 15
do shell script "open smb://username:password@servername/sharedfolder"

(obviously, change the username, password, servername, and sharedfolder to match your setup.)


-- Run it first by pressing the "play" button at the top of the Script Editor window. Gotta make sure it works before you save it.


-- Save it as an Application (NOT as a Script!!) to your Applications folder. Call it whatever you want. I call mine "MountShareDrive" (no spaces). I highly recommend you *don't* use spaces, because if you ever need to use this app in a script, you'll regret having spaces in the name.


-- In System Settings | General | Login Items, click on the + in the Open At Login list and browse to your Applications folder. Double-click on your newly-created application to add it to your Login Items list.


Next time you reboot, it'll login to your network share 15 seconds after you log in. The "delay 15" line is what finally fixed my problem. The Mac apparently takes a few seconds to query the network as to the names of all the local devices it can see. Simply having the "open smb://blah-blah-blah" command with no delay will cause it to fail (as it was failing for me) with a "cannot find 'servername'" error. (And, of course, as soon as I manually ran that "open smb://blah-blah-blah" command, it'd work fine. Because it had been long enough since login for the Mac to know the names of the local devices.). If you still get "server unknown" errors, just increase the delay. Maybe your network (or the shared devices) are slower to respond than mine are. And of course, make sure you can actually connect to the device manually, before you try to do this via a login script.


Again, Apple, y'all could make this A LOT EASIER!!! Ridiculous!!!! MacOS is supposed to be the BETTER alternative to Windows. This kind of stuff *REALLY* makes Windows look better. Ugh! I'm an advanced user and it took me TWO DAYS to figure it out. UNACCEPTABLE!!!!


Feb 5, 2023 5:41 PM in response to steve626

So HOW do I get it to DO THIS?!!!!! I have tried A DOZEN different things and NONE OF THEM WORK!!!! My Windows laptop can connect to my NAS every single time!! But this stupid MacBook cannot! Unless I do it manually by double-clicking on the alias I created on my desktop. But when I add the alias to my Login Items it tells me it CAN'T FIND THE STUPID NAS!!! But then I click "OK" and immediately double-click the alias on my desktop AND IT WORKS!!!


SO WHY WON'T IT WORK AUTOMATICALLY ON LOGIN?!!!!!


Feb 5, 2023 5:32 PM in response to Laurence5905

Laurence5905 wrote:

I need this stupid computer to connect to a network share AUTOMATICALLY when I log in. WHY CAN I NOT MAKE THIS HAPPEN?!!

I've tried a DOZEN different things. From adding the folder to the Login Items to writing a script that tries to tell finder to open the folder's alias. NOTHING WORKS!!! I *ALWAYS* get some kind of "cannot find networked computer" or "cannot find folder" error.

The *ONLY* way I can get it to work EVERY TIME is to place an ALIAS to the network folder on my desktop and double-click on that alias MANUALLY after I log in. BUT THAT'S NOT AUTOMATIC!!!!! HOW DO I MAKE THAT HAPPEN AUTOMATICALLY WHEN I LOG IN?!!!!!

HOW CAN WINDOWS DO THIS, BUT A MAC CANNOT?!!!

I think you are jumping to the conclusion that Macs can never do this based on your unique situation. My Mac at work connects automatically to a network drive upon start up or login. (I don't do this on my home network, however.)

How do I *RELIABLY* get my Mac to connect to a network drive *AUTOMATICALLY* on login?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.