The hanging I was experiencing happened only once after reboot, and consequent launches of the shell happened instantly.
I've spent hours debugging this issue. I eventually traced the hanging to homebrew's start script. My finding was that /usr/bin/git
was slow at start (took 12 secs to load) for some reason and Homebrew used that binary unless another was installed. I installed a newer version of git through Homebrew using brew install git
and this fixed the issue.
Investigation
I could see that the hang causes 100% CPU usage in syspolicyd and I could see a -67062 error at the end of the hang through Console.app (this error means code object is not signed at all
). Unfortunately, the error log did not point me to a specific file and I had to add echo
s inside the brew script to isolate the exact location of the hang. It turned out to be an execution of git
. Installing another version of git
that would overwrite the default one fixed the problem. I used brew install git
since homebrew checks its own directory first for a git binary.
I am not exactly sure how/why the code signature of /usr/bin/git
is broken. It wasn't broken when I first installed Homebrew. It was somehow corrupted later on.