As you talked about /and many others/fstab, I’ll guess that you’ve got some familiarity with Linux and subsequently systemd. The MacOS equal (and inspiration for systemd) is launchd and the models you arrange are referred to as Launch Brokers or Launch Daemons.
Brokers are triggered when somebody logs in; Daemons run at boot earlier than anybody logs in.
The one distinction is the place you place the .plist file that describes them (and that Daemons are managed with root/sudo permissions).
Until you completely require this distant listing to be mounted when no one is logged in to the machine, I like to recommend an Agent, because it’s a lot simpler to arrange.
There’s a superb tutorial on each right here: https://www.launchd.information
Nonetheless, as hyperlinks are usually not perpetually, let me describe how I arrange a Launch Agent to do that, after which inform you what modifications you must make to run as a Launch Daemon
I first created a listing beneath my house listing to mount the distant folder.
I then checked I may mount this on the command line as follows:
mount -t smbfs smb://myuser:mypassword@DS920/RetroArch_Shared /Customers/me/RetroArch_Shared
(“DS920” is the hostname of my Synology DiskStation 920+).
I then created ~/Library/LaunchAgents/retroarch.shared.plist
Label
retroarch.shared
ProgramArguments
/sbin/mount
-t
smbfs
smb://myuser:mypassword@DS920/RetroArch_Shared
/Customers/me/RetroArch_Shared
RunAtLoad
I then loaded that Agent with:
launchctl load ~/Library/LaunchAgents/retroarch.shared.plist
and confirmed the mounted useful resource confirmed on my Desktop.
I lastly confirmed it runs at login by ejecting the disk, logging out and again in once more.
If you wish to run the identical as a Launch Daemon:
- The plist file must go in /Library/LaunchDaemons (be aware this isn’t beneath your own home listing).
- You plist might want to embody the identify of the person that ought to carry out the motion (ideally, your personal person account).
- You will want to load/unload with sudo whereas testing.
- You may clearly have to reboot to try it out, moderately than simply logging out/in.
- Making a everlasting mountpoint (listing) beneath
/Volumes
shouldn’t be really helpful, as that’s the place mountpoints are routinely generated for thumb drives, downloaded .dmg information, and many others.