How to access a research/network share in RStudio on a Mac

Once authenticated, a network/research share can be accessed directly in RStudio for Windows using the path to the share in your code, for example:

dir ="\\ahsfile\share$\subfolder"



When working with RStudio on a Mac, the network shared becomes a local volume and you need to use that path in your script.


  1. Connect to the network share on your Mac using Finder (Go - Connect to Server)

  2. Enter the path to the share root level (e.g. smb://ahsfile/share$) or subfolders as desired (e.g. smb://ahsfile/share$/subfolder)

  3. On your Mac, this becomes a mounted volume and is accessible under /volumes. So, within RStudio you can use /volumes followed by the folder that you accessed (either the root or a subfolder).

    1. If you connected to the root, it would be /volumes/share$

    2. If you connected to a folder named “subfolder” you would use /volumes/subfolder in your code.

The easiest way to verify which path to use is to open up a terminal window and type ls /volumes and see what folders are listed.

The Mac version of the sample code above would be:

dir ="/volumes/subfolder"



Map a Network Drive (Mac) - HEALTH-HELP