Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've installed Samba3 from MacPorts. (following this guide) To run it I execute sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D in a Terminal window and everything works fine.

I've attempted to create a LaunchAgent to run samba with the system, rather than having to invoke it manually. My plist file is called com.samba3.plist and consists of the following:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

However, on system startup samba is not being run.

share|improve this question

I see several things that need fixing:

  1. This should be installed as a LaunchDaemon, not a LaunchAgent. The difference is that an agent runs inside a user login session, as the user; a daemon runs independent of who is or isn't logged in, and generally runs as root (which you need here).
  2. The ProgramArgument list isn't parsed by a shell, so && doesn't do what you want -- it's just passed as an argument to smbd. You really should make two launchd items, one for smbd and one for nmbd.
  3. The -D flag to each program tells it to daemonize, i.e. detach and run in the background; launchd expects the things it launches to stay connected so it can monitor them (and in fact will think a program has quit if it daemonizes). Remove the -D flags, and use -F instead.

Also, if you have Snow Leopard (installed or available) take a look at the launchd items that start the system's version of smbd and nmbd; they're /System/Library/LaunchDaemons/smbd.plist and .../nmbd.plist. They contain some additional tricks which you may find useful. Most notably, nmbd is set to auto-relaunch if the network is up, and smbd is only launched on demand when a connection is received.

share|improve this answer
Very nice answer. Dense and informative. +1 – Harv Aug 22 '11 at 20:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.