There are multiple ways to make your mac mounting shares at login.
What I was trying to achieve is mounting Documents, Desktop and all the main data folders shared from my Linux host machine into my MAC VM.
And yes, I’m running MAC OS within a VMWare Virtual Machine from an Ubuntu computer.
Here the way that worked for me 🙂
Create a bash script called mount_all.sh with all your lines and I have stored it into /Users/macuser:
#!/bin/bash sudo mount -t vmhgfs .host:/Desktop /Users/macuser/Desktop sudo mount -t vmhgfs .host:/Documents /Users/macuser/Documents sudo mount -t vmhgfs .host:/Downloads /Users/macuser/Downloads sudo mount -t vmhgfs .host:/Movies /Users/macuser/Movies sudo mount -t vmhgfs .host:/Music /Users/macuser/Music sudo mount -t vmhgfs .host:/Pictures /Users/macuser/Pictures
Than, I have created the following file in /Library/LaunchAgents/ (as root) called com.vmware.launchd.z-custom-mount.plist:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.vmware.custom-mount</string> <key>Program</key> <string>/Users/macuser/mount_all.sh</string> <key>RunAtLoad</key> <true/> </dict> </plist>
After, I have verified that the syntax was ok with this plutil command:
root:/Library/LaunchAgents # plutil com.vmware.launchd.z-custom-mount.plist com.vmware.launchd.z-custom-mount.plist: OK
Last step is to load the file:
launchctl load com.vmware.launchd.z-custom-mount.plist
At your next boot, once login, the script mount_all.sh will be executed 🙂
The nice thing here is that you have the flexibility to add/remove shares simply modifying that script, without really need to change any System configuration.
NOTE: I had to add this in visudo
macuser ALL=(ALL) NOPASSWD: /sbin/mount,/sbin/umount