Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

Trying

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.

ANSWER

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 Terminal.app allowed me too.

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

share|improve this question

2 Answers 2

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 Terminal.app 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

Your Answer

 
discard

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.