I have a large set of mac mini's in the field with smb/afp shares enabled. For reasons completely unknown to me the file sharing sometimes gets disabled for some nodes. I could not find a single thing in the logs, but for now I'm trying to write a quick workaround until we can find the issue.

Currently I'm writing a script that simply periodically checks if file sharing is enabled, and otherwise forcing it on again. A lot can be done with the systemsetup binary, but it can't do anything for filesharing.

Can anyone tell me either what commandline binary is used to enable file sharing, or which services specifically I need to launch with launchctl?

1 Answer 1


Proper tools in macOS client are sharing and launchctl which have to be run as root:

Check man sharing how to use it.

To start/stop or load AFP or SMB use:

sudo launchctl [subcommand] -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist


sudo launchctl [subcommand] -w /System/Library/LaunchDaemons/com.apple.smbd.plist

The proper tool to deal with macOS server related tasks is serveradmin which has to be run as root:

sudo serveradmin -h
Usage: serveradmin [-dhvx] [list | start | stop | status | fullstatus | settings | command] [<service_key> [ = <value> ]]

  -h, --help     display this message
  -v, --version  display version info
  -d, --debug    print command
  -x, --xml      print output as XML plist
serveradmin list
    --Lists all services
serveradmin start afp
    --Starts afp server
serveradmin stop ftp
    --Stops ftp server
serveradmin status web
    --Returns current status of the web server
serveradmin fullstatus web
    --Returns more complete status of the web server
serveradmin settings afp
    --Returns all afp configuration parameters
serveradmin settings afp:guestAccess
    --Returns afp guestAccess attribute
serveradmin settings afp:guestAccess = yes
    --Sets afp guestAccess to true
serveradmin settings
    --Takes settings commands like above from stdin
serveradmin command afp:command = getConnectedUsers
    --Used to perform service specific commands
serveradmin command
    --Takes stdin to define generic command that requires other parameters
  • serveradmin is a tool which ships with apple server ( server.app), This is not present on our nodes. Therefore this tool isn't available either.
    – J. Meijers
    Feb 13, 2017 at 9:43
  • @J.Meijers Oh I didn't read your question properly. macOS server isn't installed on the Mac?
    – klanomath
    Feb 13, 2017 at 9:44
  • It isn't. Assume for now that it is a 'vanilla' 10.11 or 10.12 macOS install
    – J. Meijers
    Feb 13, 2017 at 9:45
  • I think my issue is very similar to: discussions.apple.com/thread/7525002?tstart=0
    – J. Meijers
    Feb 13, 2017 at 10:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .