Skip to content

Commit

Permalink
watchman: launchctl unload post-install (#9456)
Browse files Browse the repository at this point in the history
This is taking a run at: facebook/watchman#358

Watchman installs and updates its own launchd.plist file on behalf of the user; it is not integrated with `brew services`.
In the linked issue, watchman would stop working for some homebrew users.  The problem was that the launchd.plist used socket activation to set up the service, and because launchd is maintaining the socket, and the socket connection attempt just hangs, watchman never had a chance to fix up the plist and things stayed broken.

To help solve this, we're forcing an unload in the post-install portion of the recipe.
  • Loading branch information
wez authored and MikeMcQuaid committed Feb 10, 2017
1 parent 1aff955 commit b546ce7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Formula/watchman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ def install
def post_install
(var/"run/watchman").mkpath
chmod 042777, var/"run/watchman"
# Older versions would use socket activation in the launchd.plist, and since
# the homebrew paths are versioned, this meant that launchd would continue
# to reference the old version of the binary after upgrading.
# https://github.com/facebook/watchman/issues/358
# To help swing folks from an older version to newer versions, force unloading
# the plist here. This is needed even if someone wanted to add brew services
# support; while there are still folks with watchman <4.8 this is still an
# upgrade concern.
home = ENV["HOME"]
system "launchctl", "unload",
"-F", "#{home}/Library/LaunchAgents/com.github.facebook.watchman.plist"
end

test do
Expand Down

0 comments on commit b546ce7

Please sign in to comment.