Jordan Walsh Jordan Walsh - 5 months ago 10
PHP Question

OS X PATH problems: Home directory set to /Applications/XAMPP

I was using XAMPP, and added a XAMPP sub-directory to my PATH in ~/.bash_profile, and now for some reason all of a sudden /Applications/XAMPP is my home directory (e.g. when I type "cd ~" and do "ls", it only lists the contents of the XAMPP folder. And because of this, I can't find my ~/.bash_profile to revert the PATH back to normal. It seems to have disappeared. Any suggestions?

Answer

I'm not completely sure what causes you to end up in /Applications/XAMPP. But I can tell you a way to debug a login shell:

PS4='+ $BASH_SOURCE:$LINENO: ' bash -xlic ''

-x is for debug, -l is login, -i is interactive, and -c '' is a NOP command.

PS4 will be appended on each line printed by -x, and in our case it will print file and line number from where the code is executed.