- This article will enable you to permanently ‘Map’ or ‘mount’ network drives on your Mac OS without having to connect to them in Finder each time.
- Please see the ‘Summary Overview’ tab below for a high level view of the objectives this ‘howto’ will achieve.
Why might I want to do this?
- If you have a lot of network drives it can be frustrating to do this every time your restart your computer.
- If you are running a server on your Mac.
- If you are hosting an application on your Mac that relies on remote storage
- If you have a NAS
To be clear, what is a network drive and what is mapping and mounting?
Simply put, a network drive is a folder or directory that does not reside on your computer, but on another device which you connect to via the network. Examples of devices that may have a network ‘share’ on them include, “A computer different to your own, Network Attached Storage (NAS), a Server such as Windows Server, Mac OS Server or a linux Server such as RedHat.
‘Mapping’ or ‘Mounting’ a drive refers to the process whereby your computer knows to reconnect to that drive so you don’t have to manually find it and connect to it each time you reboot or start up your computer. Common use cases for wanting a mapped drive include things such as running a Media Server on your computer, having a mapped ‘home’ drive separate from your computer for security or backup reasons or having someone in your family, or flat that has shared files your want to connect to.
This article does not go into how to create the share, only how to connect to an existing share.
A word about modifications
Being a Mac, it’s strong suit is unfortunately NOT networking. It does have robust networking protocols and reliable methods of connecting to other systems and devices – and even an underlying system (kernel) that supports many traditional ways of connecting. However Mac OS has never been designed to work well in a network connected office environment. There have been great advances in this area, but the concept of mapping drives is still a concept which Apple refuse to embrace, which is very strange considering how much focus Apple put’s on useability.
Anyway, it’s important to note that to work around these problems we need to make a very small (completely reversible) modification to the underlying system to make everything work properly.
To a Mac person who’s not used to having to do this kind of thing, this can be quite scary, however, I can say from first hand experience because Mac OS is the ONLY operating system which provides such a consistent, low issue user experience, if you had been on Windows (which DOES have a great mapped drive feature built within it), there would be many more things we would have had to do to get things running in Windows. Windows is legendary for it’s inconsistencies and high support costs.
Please note: It isn’t mandatory, but it helps if you’re familiar with using a basic text editor such as Nano or Vi to complete this Howto.
Software Dependencies
- Mac OS
- A shared network drive
Hardware Dependencies
- None
Tools Required
- Console administrator
- A console text editor such as Nano or Vi
Other Dependencies
- A working network – virtual, physical or otherwise
The below lists the high level summary of steps we’re about to take during this howto.
- Open the Mac OS Terminal
- Create the mountpoints
- Become SuperUser
- Edit the fstab file
- Save the file
- Restart the computer
Open the Mac OS Terminal
- Go into the Mac finder, click on the ‘Applications’ section in the left navigation pane and then find the ‘Utilities’ folder.
- In the Utilities folder you will see the Terminal Application, Open this by double clicking on it.
Create the mountpoints
Mapping /mounting in *Nix environments (of which Mac OS is one) works slightly differently to Windows. Automount essentially maps a network share to a previously created folder / directory on your local hard drive. In this way, the network shares will actually appear to be any folder on your local hard drive you choose. So let’s create the mountpoints (as your ordinary user). Note: These mountpoints will be using your ordinary users password, so it pays to put them somewhere where other users of your system won’t have access such as /Users/yourusername/Volumes/Mountpoint
- In terminal type ‘ls’ (this will show you which folder you’re in, you should by default go to your home folder which is to say /Users/yourusername which is what we want.
- Type ‘mkdir Volumes’ <ENTER> to create a folder / directory named Volumes
- Type ‘cd Volumes’ <ENTER> to go into that folder. If you type ‘ls’ now, you should see an empty folder.
- Type ‘mkdir yourmountpointname’ for any and all mountpoints you want to create, which will end up being network drives.
- Type ‘ls’ <ENTER> when finished to display the list of folders / directories you have just created.
Become SuperUser
- Become superuser (or root as it’s sometimes called) by typing ‘su’ <ENTER> in the terminal. (If you haven’t done this before, see our article on how to setup a root password on mac and become SuperUser here).
Edit the fstab file
- Type, ‘Nano /etc/fstab’ (this file may not exist, if not go ahead and create a new one)
- For each share you want to automatically connect to, have a line like below:
- yourservername:/yourserversharename /Users/yourusername/Volumes/yourmountpointname url automounted,url==cifs://yournetworkusername:yournetworkpassword@yourservername/Video 0 0
Note: This article assumes your server has a Windows style (Samba or CIFS) type of share. If you have a different type, you’ll know what that means and can replace the ‘cifs’ wording above with something more appropriate such as NFS.
An example of one of my fstab lines is as follows:
192.168.43.15:/home /Users/myusername/Volumes/Home url automounted,url==cifs://myusername:mypassword@192.168.43.15/home 0 0
- Save your fstab file by pressing CTRL-X on your keyboard and pressing ‘Y’ to confirm the changes.
Restart your computer
The next step is to restart your computer to make the changes active. It is possible to execute another command instead of rebooting, however I’ve had problems when doing that and found a reboot works better.
If it doesn’t work, check your share names, passwords and mount points are exactly as you created them as some of them are case sensitive (capital letters make a difference).
And that’s it!
There are many way’s to connect to network drives in MacOS, but there are not many way’s to automatically do it. This howto outlines how I do it on my machines and it works quite well. If you have any other alternative methods (paid or otherwise) as always, I welcome your insights and opinions in the comments section below.
Marshalleq