How to Mount SMB Share in Mac Terminal: Step-by-Step Guide
This guide shows how to mount SMB share in Mac Terminal with step-by-step instructions, automatic setup, and troubleshooting tips.
You need to access files stored on a network server, but the graphical interface seems slow or limited. Using Mac Terminal can speed up your connection to SMB shares and offer more control.
This article explains how to mount SMB share in Mac Terminal with clear, step-by-step instructions. It covers manual mounting commands, setting up permanent or automatic mounts at startup, and compares the process with Linux and Windows methods. You will also find troubleshooting tips for common connection issues.
Key takeaways
- Use the mount_smbfs command to manually mount SMB shares in Mac Terminal.
- Setting up entries in
/etc/fstabor login scripts enables automatic mounting at startup. - Mac mounting syntax differs from Linux's
mount -t cifsand Windows' drive mapping. - Common issues include permission errors and network visibility problems, often fixed by verifying credentials and share paths.
Before you start: What you need to mount an SMB share on Mac
Before mounting an SMB share using the Mac Terminal, ensure you have network access to the SMB server and the correct credentials. The server address can be an IP address like 192.168.1.100 or a hostname such as fileserver.local. You also need the share name, for example, Documents or SharedFolder.
Confirm your macOS version supports SMB protocol versions commonly used, including SMB 1.0, SMB 2.0, and SMB 3.0. Modern macOS versions generally support SMB 2 and SMB 3 by default, offering better security and performance than SMB 1.
Familiarity with basic Terminal commands is necessary, including changing directories and using mount commands. You should also understand macOS permissions because mounting SMB shares may require elevated privileges. Using sudo might be necessary to grant these permissions.
- Verify network connectivity by pinging the SMB server address (e.g.,
ping 192.168.1.100); a successful response shows network access. - Confirm you have a valid username and password for the SMB share; these are usually provided by your network administrator or IT department.
- Check the SMB share path format: it generally looks like
//username@server_address/share_name. - Open Terminal and test simple commands like
lsandcdto ensure comfort with command-line navigation. - Determine if you can use
sudoby runningsudo -v; this should prompt for your password without error.
Completing these steps means you are prepared with the necessary information and environment to mount an SMB share via Terminal on your Mac.
How to mount SMB share on Mac Terminal step-by-step
- Create a local mount point directory. Open Terminal and enter
mkdir ~/mnt/smbshareto create a folder where the SMB share will be mounted. If successful, Terminal returns to the prompt without errors. - Use the
mount_smbfscommand to mount the share. Run the command in this format:mount_smbfs //username@server/share ~/mnt/smbshare. Replace username with your SMB username, server with the SMB server IP or hostname, and share with the share name. For example:mount_smbfs //[email protected]/sharedocs ~/mnt/smbshare. If prompted, enter your SMB password securely; the input will not be displayed. - Verify the mounted share in Finder. Open Finder and navigate to the
~/mnt/smbsharedirectory. You should see the files and folders from the SMB share accessible here. - Check the mounted share via Terminal. Run
df -h | grep smbto confirm the share is mounted. Output typically shows the SMB server path and the local mount point, indicating success. - Unmount the SMB share when done. Use
umount ~/mnt/smbshareto safely disconnect the share. The prompt returns without errors, and the share disappears from Finder.
Note: Avoid including passwords directly in the command to maintain security. Enter credentials when prompted or configure keychain access for smoother authentication.
How to mount SMB share on Mac permanently or auto mount at startup
Automating the mounting of SMB shares on Mac can improve workflow efficiency, but macOS has specific constraints and options to consider.

Using /etc/fstab for persistent mounts
You can add SMB shares to /etc/fstab for persistent mounting, but macOS often ignores this file for network mounts, making this method unreliable. An example entry looks like:
//username:password@server/share /Volumes/Share smbfs rw 0 0
However, storing credentials in plain text here poses a significant security risk, and the mount may fail silently or not persist across reboots.
Automating with AppleScript or Automator and launch agents
AppleScript or Automator workflows can mount SMB shares by running the appropriate Terminal command or using Finder’s "Connect to Server" feature. Combining these with launchd launch agents enables automatic execution at login.
- Create an AppleScript that mounts the SMB share using
mount volume "smb://server/share". When run, the share should appear in Finder. - Save the script as an application in a secure location.
- Create a
launchdplist file in~/Library/LaunchAgents/referencing the script’s path. - Load the plist using
launchctl load ~/Library/LaunchAgents/your.plist. On next login, the SMB share mounts automatically.
Shell scripts and launchd for auto mount
Alternatively, shell scripts running mount_smbfs can be triggered by launchd at startup. This method offers more control but requires careful scripting and secure handling of credentials (e.g., using macOS Keychain).
A sample launchd plist snippet to run a script at login:
| Key | Value |
|---|---|
Label | com.user.mountsmb |
ProgramArguments | ['/path/to/mount_script.sh'] |
RunAtLoad | true |
Security considerations: Avoid embedding passwords directly in scripts or /etc/fstab. Use macOS Keychain or prompt for credentials to minimize risks. Scripts with stored credentials should have strict permissions (chmod 700).
Comparison: /etc/fstab is simplest but unreliable and insecure; AppleScript with launchd balances ease and security; shell scripts with launchd offer flexibility but require more setup and secure credential management.
How to connect to SMB on Mac compared to Linux and Windows
Connecting to SMB shares varies across Mac, Linux, and Windows due to differences in command syntax, credential handling, and user interface options. Mac uses the mount_smbfs command in Terminal, while Linux typically employs mount -t cifs. Windows users often rely on graphical tools like "Map Network Drive" in File Explorer.
On Linux, mounting an SMB share involves a command such as:
sudo mount -t cifs //SERVER/Share /mnt/point -o username=user,password=pass
This command specifies the CIFS filesystem type and allows multiple options for credentials and permissions. Linux users can also use a credentials file for security.
Windows primarily uses a GUI method: Navigate to File Explorer > This PC > Map Network Drive, then enter the share path (e.g., \\SERVER\Share) and authenticate via a prompt. Command-line options exist via net use, for example:
net use Z: \\SERVER\Share /user:username password
Mac Terminal uses mount_smbfs instead of mount -t cifs because macOS implements SMB mounting through its own SMB file system interface rather than the CIFS kernel module common in Linux. Credential handling on Mac often involves providing the username and password inline or using the Keychain for stored credentials.
Choosing GUI or Terminal depends on user preference and task complexity. Windows users typically find the GUI easier for simple mounts, while Linux and Mac power users often prefer Terminal for scripting and automation.
| Platform | Command or GUI | Example Command | Credential Handling |
|---|---|---|---|
| Mac | Terminal | mount_smbfs //user@SERVER/Share /Volumes/Share | Inline or Keychain |
| Linux | Terminal | sudo mount -t cifs //SERVER/Share /mnt/point -o username=user,password=pass | Inline or credentials file |
| Windows | GUI or Command Line | net use Z: \\SERVER\Share /user:username password | Prompt or inline |
Troubleshooting common SMB mounting issues on Mac Terminal
When mounting SMB shares via Terminal, you may encounter authentication failures, network problems, permission errors, or protocol mismatches. Resolving these issues involves targeted checks and fixes.

Authentication failures and password prompts
- Double-check your username and password syntax in the mount command. Authentication errors often show as "mount_smbfs: Authentication error". Correct usage includes mount_smbfs //username@server/share /mountpoint.
- If prompted repeatedly for a password, verify the account has access to the SMB share and the password is correct. You can also specify the password in a keychain or use mount_smbfs with a credential file to avoid manual prompts.
Network connectivity and DNS resolution
- Ping the SMB server by IP and hostname to confirm network access and DNS resolution. For example, ping servername.local should return replies.
- If ping fails, check your Mac’s network connection, firewall settings, or VPN configurations that might block SMB traffic on ports 445 or 139.
Permission errors and mount point access
- Ensure the local mount point directory exists and you have write permissions. Use ls -ld /mountpoint to verify ownership and permissions.
- If you see errors like "Permission denied", adjust permissions with chmod or create the mount point in a directory you own, such as
/Users/yourname/mountpoint.
SMB protocol version mismatches
- Some SMB servers require specific protocol versions. macOS tries SMB 3 by default, but you can force SMB 1 or 2 using the vers= option in the mount command, e.g., mount_smbfs -o vers=2.1 //username@server/share /mountpoint.
- Check server documentation or logs for supported SMB versions if you encounter protocol negotiation errors.
Using logs and commands to diagnose problems
- Review system logs for SMB-related errors using log show --predicate 'process == "mount_smbfs"' --last 1h to see recent mount attempts and error messages.
- Use smbutil statshares -a to list active SMB connections and their statuses for additional insight.
- How to Use SSH in Mac Terminal: A Clear Step-by-Step Guide
- How to Generate an SSH Key in Mac Terminal: A Step-by-Step Guide
- How to Take Ownership with chown in Mac Terminal: A Step-by-Step Guide
- How to Change File Permissions with chmod in Mac Terminal
Frequently asked questions
How to mount smb share on linux?
To mount an SMB share on Linux, you typically use the mount command with the cifs filesystem type. First, create a mount point directory using mkdir. Then, mount the share with a command like sudo mount -t cifs //server/share /mnt/point -o username=youruser,password=yourpass. You may need to install the cifs-utils package for full support.
How to mount smb share on windows?
On Windows, you can map an SMB network drive via File Explorer by selecting Map network drive from the Computer tab. Enter the SMB path like \\server\share, assign a drive letter, and provide credentials if prompted. Alternatively, use the net use command in Command Prompt for more control.
How to connect to mac using smb?
To connect to a Mac via SMB, ensure File Sharing is enabled in System Preferences > Sharing and SMB sharing is active. From another device, access the Mac’s SMB share using the address smb://mac-ip-address or smb://mac-hostname. Enter the Mac user’s credentials when prompted.
How to mount smb on linux?
This question is similar to mounting an SMB share on Linux. Use the mount -t cifs command with proper options and credentials. Ensure cifs-utils is installed, and create a mount point beforehand.
How to mount smb share on linux
Mounting an SMB share on Linux requires creating a mount point and using the mount command with the cifs type. Include options such as username= and password=, or use a credentials file for security. The process may vary slightly depending on your Linux distribution.
What this advice does not cover and who should consider alternatives
This guide does not cover advanced network SMB server configuration or troubleshooting beyond the client side on Mac Terminal. If you need to modify server settings or diagnose server-related issues, consult specialized network administration resources or your server administrator.
Users unfamiliar with Terminal commands or lacking administrative rights on their Mac may find some steps challenging. In such cases, using the Finder's built-in Connect to Server feature or third-party graphical SMB clients might be more suitable.
Auto mounting SMB shares can expose credentials if not handled carefully. Always consider the security implications of storing passwords in plain text within scripts or system files, and prefer keychain integration whenever possible.
The most useful next step is to familiarize yourself with the mount_smbfs command options and experiment with mounting shares manually in Terminal. This hands-on experience helps you understand connection parameters and troubleshoot access issues before setting up permanent or automated mounts.