Can I get a verbose error output from brew services?

I run offlineimap with brew services. When I run it manually it works fine, but when the service runs I get the following error in the console log:

Mar 19 10:27:31 Compe com.apple.xpc.launchd[1] (homebrew.mxcl.offlineimap[53215]): Service exited with abnormal code: 1

brew services list gives:

started Andy /Users/Andy/Library/LaunchAgents/homebrew.mxcl.offlineimap.plist

with the error color and launchctl list | grep “offlineimap” gives:

  • 1 homebrew.mxcl.offlineimap

Is there a way to get a more verbose output of launchd’s attempts to run the offlineimap service so I can attempt to debug the issue?

Things I’ve tried:

  • uninstalling/reinstalling offlineimap
  • restarting offlineimap service

I think the easiest way is to look in brew info offlineimap and see what command it runs in the service and run that in your shell.

I looked in the plist file and it showed:

/usr/local/opt/offlineimap/bin/offlineimap

as the command. When I run it it completes with no errors.

Looking in that plist file showed these two keys:

StandardErrorPath
/dev/null
StandardOutPath
/dev/null
StandardOutPath

I tried setting those to output to log files instead of /dev/null but they don’t seem to write anything after running.

What if you run /usr/local/opt/offlineimap/bin/offlineimap -q -u basic

It runs normally with no errors. I tried running it with the -u syslog flag and got this:

File “/usr/local/Cellar/offlineimap/7.3.2/libexec/offlineimap.py”, line 22, in
oi.run()
File “/usr/local/Cellar/offlineimap/7.3.2/libexec/offlineimap/init.py”, line 89, in run
options, args = self.__parse_cmd_options()
File “/usr/local/Cellar/offlineimap/7.3.2/libexec/offlineimap/init.py”, line 269, in __parse_cmd_options
self.ui = UI_LISTui_type.lower()
File “/usr/local/Cellar/offlineimap/7.3.2/libexec/offlineimap/ui/Noninteractive.py”, line 37, in init
return super(Syslog, self).init(config, loglevel)
File “/usr/local/Cellar/offlineimap/7.3.2/libexec/offlineimap/ui/UIBase.py”, line 75, in init
self._log_con_handler = self.setup_consolehandler()
File “/usr/local/Cellar/offlineimap/7.3.2/libexec/offlineimap/ui/Noninteractive.py”, line 41, in setup_consolehandler
ch = logging.handlers.SysLogHandler(’/dev/log’)
File “/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/handlers.py”, line 761, in init
self._connect_unixsocket(address)
File “/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/handlers.py”, line 804, in _connect_unixsocket
self.socket.connect(address)
File “/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py”, line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 2] No such file or directory

So the error is probably with offlineimap.