For a while now, my slack auto update has been broken.
I check for updates, and slack diligently closes. Then … errr nothing. What should happen is that it restarts as the new shiny updated version.
I finally got around to working out what was wrong. In my console there was a lot of these errors:
Oct 4 13:20:01 Matts-MBP com.apple.xpc.launchd[1] (com.tinyspeck.slackmacgap.ShipIt): Service only ran for 0 seconds. Pushing respawn out by 2 seconds. Oct 4 13:20:03 Matts-MBP com.apple.xpc.launchd[1] (com.tinyspeck.slackmacgap.ShipIt[11423]): Service could not initialize: 16G29: xpcproxy + 11769 [1505][1E2A2740-D4E5-342E-A502-4792BD02598D]: 0xd
A quick jump into the shell to find out how this service is configured:
$ launchctl list com.tinyspeck.slackmacgap.ShipIt$ launchctl list com.tinyspeck.slackmacgap.ShipIt{ "StandardOutPath" = "/Users/matt/Library/Caches/com.tinyspeck.slackmacgap.ShipIt/ShipIt_stdout.log"; "LimitLoadToSessionType" = "Aqua"; "StandardErrorPath" = "/Users/matt/Library/Caches/com.tinyspeck.slackmacgap.ShipIt/ShipIt_stderr.log"; "MachServices" = { "com.tinyspeck.slackmacgap.ShipIt" = mach-port-object; }; "Label" = "com.tinyspeck.slackmacgap.ShipIt"; "TimeOut" = 30; "OnDemand" = true; "LastExitStatus" = 0; "Program" = "/Applications/Slack.app/Contents/Frameworks/Squirrel.framework/Resources/ShipIt"; "ProgramArguments" = ( "/Applications/Slack.app/Contents/Frameworks/Squirrel.framework/Resources/ShipIt"; "com.tinyspeck.slackmacgap.ShipIt"; );};
Lets look in that directory:
$ ls -hl /Users/matt/Library/Caches/com.tinyspeck.slackmacgap.ShipIt total 317560 -rw-r--r--+ 1 matt staff 278B 4 Oct 13:12 ShipItState.plist -rw-r--r--+ 1 root staff 155M 26 Feb 2017 ShipIt_stderr.log -rw-r--r--+ 1 root staff 0B 14 Feb 2017 ShipIt_stdout.log drwx------+ 3 matt staff 102B 4 Oct 13:10 update.px2Emxl
Thats odd – the stderr.log is not up to date – but it is slightly enormous and full of errors from 8 months ago and also owned by root – how odd.
$ tail -f /Users/matt/Library/Caches/com.tinyspeck.slackmacgap.ShipIt/ShipIt_stderr.log 2017-02-26 13:55:51.392 ShipIt[61457:9745731] Installation error: Error Domain=SQRLShipItRequestErrorDomain Code=2 "Could not read update request" UserInfo={NSLocalizedDescription=Could not read update request, NSUnderlyingError=0x7fdb09f03f30 {Error Domain=NSCocoaErrorDomain Code=260 "The file “ShipItState.plist” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/var/root/Library/Caches/com.tinyspeck.slackmacgap.ShipIt/ShipItState.plist, NSUnderlyingError=0x7fdb09f02710 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}}} 2017-02-26 13:55:51.393 ShipIt[61457:9745731] ShipIt quitting
Lets remove the directory and try again (while Slack is closed):
$ mv /Users/matt/Library/Caches/com.tinyspeck.slackmacgap.ShipIt/ /Users/matt/Library/Caches/com.tinyspeck.slackmacgap.ShipIt.old
When I opened up slack, this directory was refreshed. Then this time, after I clicked Check for updates – it actually worked, and the shipit service respawn errors disappeared from my console (probably saving me battery as well 🙂 ).
Everything looking healthier now:
$ ls -ahl /Users/matt/Library/Caches/com.tinyspeck.slackmacgap.ShipIt total 40 drwxr--r--+ 5 matt staff 170B 4 Oct 13:22 . drwxr-xr-x+ 172 matt staff 5.7K 4 Oct 13:19 .. -rw-r--r--+ 1 matt staff 278B 4 Oct 13:22 ShipItState.plist -rw-r--r--+ 1 matt staff 13K 4 Oct 13:22 ShipIt_stderr.log -rw-r--r--+ 1 matt staff 0B 4 Oct 13:20 ShipIt_stdout.log
I am posting this in case others have the same problem.