Apple - How to debug Trace/BPT trap: 5?

I suspect you will by now have seen the problem reappear. The fix you described had a side-effect that ended up, for a time, solving the problem.

I believe that the problem had to do with the security context in which your terminal's shell was attempting to launch programs that try to connect to the window system.

My solution to this problem, whenever it has occurred from my shells, has been to use reattach-to-user-namespace ( For example, at a bash prompt:

tk-mbp:~ tommy$ wstorm Projects/my-webapp
Trace/BPT trap: 5
tk-mbp:~ tommy$ exec reattach-to-user-namespace -l bash
(reading ~/.bash_profile)
tk-mbp:~ tommy$ wstorm Projects/my-webapp
tk-mbp:~ tommy$ # that worked...

When you rebooted as part of the fix you reported, it had the side-effect of creating a shell process whose connection to the security context of your windowed login session was not stale, as it had been before when the commands were failing with "Trace/BPT trap: 5". So although there might have been a real problem with the PATH setup, I believe it was the refreshing of the shell's process environment that was the true fix.

FWIW, I've got reattach-to-user-namespace installed via Homebrew.