Homebrew build timeouts during "installer:PHASE:Running package scripts…"

Recently a Homebrew Cask project that used to work fine started hanging during the brew cask install --verbose ... command.

At first, it appears to install fine then seems to get stuck on “installer:PHASE:Running package scripts… with this message repeating until the job times out.

I’m not sure how to debug this further, as it works fine on my local machine. So I’m guessing it’s something that changed with the macOS VM run by the Travis build. Perhaps it could be SIP / “Full Disk Access” or something it’s waiting on, but I have no way of verifying this because I can’t see the VM’s screen.

Help much appreciated!

First hypothesis was to try removing the com.apple.quarantine extended file attribute being set on the .pkg file downloaded by Homebrew. Unfortunately this did not work:

ls -l ~/Library/Caches/Homebrew/Cask/pcloud-drive-*.pkg
lrwxrwxr-x  1 exampleuser  examplegroup  101 Aug  5 01:36 /Users/exampleuser/Library/Caches/Homebrew/Cask/pcloud-drive--3.9.4.pkg -> ../downloads/c0c7780ef71c656c433d7b8a6d733743e92f5a0d2df7c1d3d7fee9ccf4f213f2--pCloud Drive 3.9.4.pkg
xattr -l  ~/Library/Caches/Homebrew/Cask/pcloud-drive--3.9.4.pkg
com.apple.quarantine: 0081;5f2a6020;Homebrew\x20Cask;AA143268-7784-4C04-9CC2-751756596374

The fix attempted was to first force Homebrew to download the file, then remove this attribute:

brew cask audit --download pcloud-drive
==> Downloading p-def8.pcloud.com/cBZ6aLMXBZEtM10sZZZ0eLb37Z2ZZNx7ZkZoS2a7Zi5ZskZrFZUFZC5ZSFZl7ZpZ5JZ7XZE0ZQpZQ5Zm7ZxCdakZkyeCRIO0fVBAyBO3fiILpLAXvXqk/pCloud%20Drive%203.9.4.pkg
==> Verifying SHA-256 checksum for Cask 'pcloud-drive'.
audit for pcloud-drive: passed

xattr -rd com.apple.quarantine ~/Library/Caches/Homebrew/Cask/pcloud-drive-*.pkg
# Now trying to list the extended attribute returns nothing:
xattr -l  ~/Library/Caches/Homebrew/Cask/pcloud-drive--3.9.4.pkg
# no result = no attribute set

Next hypothesis was that System Integrity Protection (SIP) was preventing the .pkg installer to finish. Unfortunately, attempting to turn off SIP on the Travis CI VM did not work (at least without reboot, which I think we cannot perform):

$ sudo /usr/bin/csrutil disable

csrutil: failed to modify system integrity configuration. This tool needs to be executed from the Recovery OS.
The command "sudo /usr/bin/csrutil disable" failed and exited with 77 during .

Not sure where else to go from here, but it seems that we cannot currently finish this installer due to getting stuck at “PHASE: Running package scripts…”. I could find that only one other similar issue is this one on munki/createOSXinstallPkg#13, which mentions SIP being the root cause.

Any help working around this issue would be appreciated! It was great to have Travis CI working to test a Homebrew installer, but it seems Apple may have broken things (yet again).