macOS Terminal Network – Command Line to Unmount SMB Network Drive

macmacosNetworksmbterminal

We use Windows Server for my company network.

I do use Mac has client. When I mount a network drive, I use the following command line:

osascript -e ‘mount volume “smb://myusername:mypassword@fileserver/department/its”'

everything works fine. I am a user administrator for my network, this is the reason why I guess I am able to mount the network drive in this way and everything works fine.

But my question is: how do I unmount this network drive? What is the command line?

thank you so much

Best Answer

umount is the opposite of mount. You'll need to know the name of the mount point - that is, the name in /Volumes that corresponds to that network drive.

umount /Volumes/VolumeName

Per man umount, umount may fail for any number of reasons, and the recommend command is instead diskutil:

diskutil unmount /Volumes/VolumeName