On OS X 10.8, using terminal commands, I'd like to enable SMB sharing as if I had ticked the following checkbox under System Preferences - Sharing - File Sharing - Options:

enter image description here

I've tried the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist

But despite the smb daemon seeming to be up and running, the checkbox is still unchecked, as if something is missing.

The same command works, as an example, for screen sharing (com.apple.screensharing.plist) and even for AFP (com.apple.AppleFileServer.plist), only SMB seem to suffer from this problem.

  • Read the small print under the Check box for SMB! – Ruskes Jul 1 '14 at 8:56
  • That's a different thing. When I tick the box on System Preferences I don't need to enter passwords or anything else, so there must be a way to do the same with commands without dealing with passwords. – Emyl Jul 1 '14 at 9:06
  • On modern systems, it seems the launchctl command is all that's needed. See discussions.apple.com/thread/8463141. – spinup May 27 '19 at 1:17

I've found the solution. Two commands are needed in sequence:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist EnabledServices -array disk
| improve this answer | |

For others who might be having this same issue with a different root cause, I found that somehow my com.apple.smbd.plist file had gotten corrupt.

You can check this with cat /System/Library/LaunchDaemons/com.apple.smbd.plist. It should appear to be plain text, but if you see a bunch of weird characters, it's probably corrupt.

I simply deleted the file [and after realizing it did not get recreated on reboot] copied my com.apple.smbd.plist from another Mac into /System/Library/LaunchDaemons/. Then I checked the checkbox (or alternately, you could run sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist), and then rebooted.

Problem solved. Same issue, different root cause.

Edit: You should also verify permissions on com.apple.smbd.plist and com.apple.AppleFileServer.plist, especially if copying from a different computer. I discovered that my com.apple.AppleFileSharing.plist file had 777 permission, which was causing it not to load.

Ownership should be root:wheel, and permissions should be 644:

sudo chown root:wheel /System/Library/LaunchDaemons/com.apple.smbd.plist
sudo chown root:wheel /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
sudo chmod 644 /System/Library/LaunchDaemons/com.apple.smbd.plist
sudo chmod 644 /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
| improve this answer | |

You must log in to answer this question.

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