Fix For When Bash Can’t Find Its Debugger On macOS

Sometimes Bash needs its debugger but it can’t find it. It looks like this:

/usr/share/bashdb/bashdb-main.inc: No such file or directory
-bash: warning: cannot start debugger

For example when you start bashdb yourself with bash --debugger or set shopt -s extdebug. Another example is when your terminal turns it on.

Here is the fix that worked on my box:

brew install bashdb
bashhome=$(brew –prefix bash)
bdbhome=$(brew –prefix bashdb)
ln -s $bdbhome/share/bashdb $bashhome/share/bashdb
unset bashhome
unset bdbhome