Super User is a question and answer site for computer enthusiasts and power users. 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'd like to have launchd run offlineimap every few minutes to update my mutt message directory. I can't seem to get the plist file for offlineimap to be loaded into without using sudo though.

When running

launchctl load -S Aqua /path/to/plist

I get there error:

launch_msg(): Socket is not connected

Which I believe is related to me not having sudo permissions for the socket.


sudo launchctl load -S Aqua /path/to/plist

Runs without any problems but then offlineimap looks for the .offlineimaprc in /var/root which is unhelpful. I believe this is because offlineimap is running as the root user.

Can anyone offer any suggestions? I'm about to start pulling my hair out.


I was using iTerm2 as my terminal client. This doesn't appear to an Aqua application therefore I can't access the aqua session socket with launchctl. Running the same command in allowed me too.

Thanks to Gordon for the suggestion that lead to the answer.

share|improve this question
up vote 2 down vote accepted

That's the error launchctl gives when you aren't part of the appropriate session type. In this case, it looks like you're trying to load your launchd item into an Aqua (i.e. GUI login) session, and this is failing because you aren't running within such a session. Are you SSHing into the computer, or something like that?

BTW, the reason it works when sudoed is that running launchctl as root always talks to the System session (apparently this overrides the -S Aqua option), which is always there.

share|improve this answer
Hi Gordon, thanks for you answer. I'm running a gui session in OSX. However I'm using iTerm2 as the terminal client. Trying this using allowed me to load the plist file. – Michael Barton Jan 23 '11 at 21:19

If you still want to use launchctl from iTerm2 you could also do this:

sudo launchctl load -F /path/to/plist

That should work, since I also have the same problem as you do when I try to do a "normal" load from iTerm2

share|improve this answer

You must log in to answer this question.

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