Apple - How does one change the share name with file sharing in Mac OS X?

Use Directory Utility.

  1. Open /System/Library/CoreServices/Applications/Directory Utility
  2. Select the Directory Editor tab
  3. In the "Viewing" bar, select SharePoints in node /Local/Default
  4. Authenticate by clicking the little lock button

Shares are listed in the left-hand column. Select one and update the following as needed:

  • RecordName (the name of the listing)
  • dsAttrTypeNative:smb_name
  • dsAttrTypeNative:afp_name

Changes should take effect immediately.

Apple hid this utility for a reason: Be careful, a wrong Directory entry can wreck your Mac.

Renaming sharepoints used to be possible with the Server app, but filesharing is now handled by the normal MacOS System Preference pane.


On macOS 10.13 (and possibly earlier versions), the names of shares are controlled by .plist files in /private/var/db/dslocal/nodes/Default/sharepoints/, with one file per share.

To change the name of a share requires changing the name, afp_name, smb_name and ftp_name keys in the .plist file, and renaming the file for good measure. There are various ways to do this, including using Xcode or TextWrangler to edit the .plist file, but it is fiddly because the sharepoint directory is only accessible by root.

The easiest way is probably to use a little script like this one to make the necessary changes:

#!/bin/bash

# Usage: rename-share oldname newname

set -e
OLDNAME=$1
NEWNAME=$2

cd /private/var/db/dslocal/nodes/Default/sharepoints
if [ ! -f "$OLDNAME".plist ] ; then
    echo "No share named $OLDNAME found." 1>&2
    exit 3
fi
if [ -z "$NEWNAME" ] ; then
    echo "Must specify new name" 1>&2
    exit 2
fi

mv "$OLDNAME".plist "$NEWNAME".plist
for key in ftp_name afp_name smb_name name ; do
    defaults write /private/var/db/dslocal/nodes/Default/sharepoints/"$NEWNAME" $key -array "$NEWNAME"
done

To use it, save that to (say) ~/bin/rename-share, then chmod a+x ~/bin/rename-share to make it executable, then use it like this (assuming that John Doe's public folder is currently shared as "Public"):

$ sudo ~/bin/rename-share "Public" "John Doe's Public Folder"