How to connect to a network UNC drive from a Mac and map the resource to a drive letter

  1. Open Finder by clicking on the Finder icon in the Dock or press Command + Space to open Spotlight, type “Finder” and press Enter.
  2. In the Finder menu, click on “Go” and select “Connect to Server” or press Command + K
  3. In the Server Address field, enter the UNC path to the network drive you want to connect to (e.g. smb://server/share)
  4. If the network drive requires a username and password to connect, click on “+” button and enter the necessary information.
  5. Click on “Connect”
  6. The network drive should now appear in the left pane of Finder and can be accessed like any other drive on your computer.
  7. To map the network drive to a drive letter, you can go to the “Finder” menu, then “Preferences” then “Sidebar” and check the network drive you just added, this will make the network drive to appear in the “Devices” section of the sidebar.

    Note: If you check the “Remember this password in my keychain” option, you will not have to enter your credentials again the next time you connect to the network drive.
    And that’s it! You should now be able to access the network UNC drive from your Mac using the mapped drive letter or from the sidebar.

Here is a one-click script for connecting to a network UNC drive in a Mac:

#!/bin/bash

# Variables
username=””
password=””
server=””
share=””

# Connect to the network drive
osascript -e “mount volume \”smb://$username:$password@$server/$share\””

You will need to edit the script and replace the values of the variables username, password, server, share with the appropriate values for your network UNC drive.

You can save this script as a file with a .sh extension and make it executable by running the command :
chmod +x <filename>.sh

To run the script, open terminal and navigate to the directory where the script is located, then type:
./<filename>.sh

This script uses AppleScript and the “mount volume” command to connect to the network drive. After running the script, the network drive should be mounted and accessible in Finder.