Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to mount an SMB network share from the command line (terminal); how would I go about that?

I am using Mac OS X 10.6.4.

share|improve this question
up vote 22 down vote accepted

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
share|improve this answer
I get : `mount_smbfs: mount error: path: Input/output error', while it mounts find via Finder->Connect to Server? – Ian Vaughan Mar 2 '12 at 16:53
How do I go about it if my username has a @ char in it? For example when i am using a microsoft account like ? I tried giving the username in single and double quotes but dint work.. – Yashvit Sep 13 '14 at 14:00
I get this error: mount_smbfs: illegal option -- W – Iulian Onofrei Nov 4 '15 at 16:32
I get this error: mount_smbfs: could not find mount point /Volumes/Share: No such file or directory – Iulian Onofrei Feb 1 at 8:35
Quote from man mount on OS X Yosemite: Note: You should always use the system mount command and never call mount_smbfs directly. – ssc Jun 30 at 12:36

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.

share|improve this answer

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.

share|improve this answer
i prefer this version for quick connections in my local network, there all users are known, so this is a simpler command then using mount_smbfs - where i actually had problems concerning non existent paths - whereas if i would need to connect to some new server with special filesystem, or i would need to try another user or wanted different mount point - ok - but how often does this happen... so my thumb goes up for this simpler solution! Well Done! Ok i am a Terminal freak who still has Finder running, but that is like 90% of us, right? – hexerei software Sep 12 '15 at 14:00
Isn't Finder always opened, at least as a process? – Iulian Onofrei Feb 1 at 8:40
@Iulian Onofrei: Not unless the user is logged in interactively. I've needed to use the direct mount command in cron jobs. Using the open command, these would fail if the interactive session was gone, e.g., after a power failure. – George Feb 9 at 22:21
Also, note that open always exits as if it were successful if it passed the command along to Finder, even if the command later failed to connect to the network drive. – Jonathan Wren Jul 17 at 2:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.