Apple - How can I mount an SMB share from the command line?

You could easily achieve this using mount_smbfs (which is, actually, a wrapper for mount -t smbfs) :

mount_smbfs //user@SERVER/folder ./mntpoint

Optionally, add the workgroup :

mount_smbfs -W workgroup //user@SERVER/folder ./mntpoint

You could, of course, change the ./mntpoint (for something like /Volumes/smb).

After doing this, simply go to ./mntpoint to browse your data.

To unmount, using the following command :

umount ./mntpoint

Use the open(1) command and a URL:

open 'smb://username:password@server/share'

Pros: Creates the mount point in /Volumes for you.

Cons: Requires the Finder to be running.


You should take a look at mount’s help:

man mount

Upon closer inspection you’ll see that the filesystem’s type is:

mount -t smbfs //username:password@MACHINENAME/SHARENAME /SomeLocalFolderOfChoice

Password (and theoretically username) are optional.

The result of the above command will be no output (if all went ok), but a cd /SomeLocalFolderOfChoice, should produce the remote results. Please note that SomeLocalFolderofChoice must exist.

You can also use mount_smbfs to replace the mount -t smbfs.