How to debug Trace/BPT trap: 5?

Solution 1:

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 Terminal.app shells, has been to use reattach-to-user-namespace (https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard). 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.

Solution 2:

It seems that the PATH variable was causing the problem.

Using iTerm, the PATH variable included unpredictable Unicode characters. I tracked it down to an entry which I added to the /etc/paths.d directory (the path $HOME/bin). It contained after the path a linefeed. By editing the fikle with nano, I did not manage to delete this Unicode(?) character, i.e. restarting did not solve the problem, but I used then Emacs and deleted all characters after the path (two characters shown as spaces which were not visible using nano) and added a RETURN.

Rebooted and it was working - and it still is.

Hope it stays like this.

Thanks for your input.

Solution 3:

I had the same problem.

I had a hidden file in /etc/paths.d/ that was confusing my PATH variable. I deleted the file and everything works as normal now.

FYI the file was an undo file generate by vim: .<original filename>.un~