Open new Terminal tab in current working directory doesn't work

So I found the problem with the Terminal and I'm posting the answer hoping it can help others. The problem was in the definition of the PROMPT_COMMAND environmental variable. I changed its definition from

export PROMPT_COMMAND='history -n;'

to

export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} history -n"

appending at the end of the existing PROMPT_COMMAND instead and this solved the problem.


I have noticed that this kind of behaviour also reproduces, when having whitespaces in your hostname.

$ sudo scutil --set HostName 'no-whitespace-name' fixes this issue.


Well Terminal will certainly open a new tab or window in the current directory if you are at the prompt in bash all things working well.

I'm running Terminal version 2.4 on 10.9.4 and it works perfectly for both new tabs and windows.

If it doesn't then something is upsetting things. Try moving your .profile, .bash_profile and .bashrc out of the way in case something in them is upsetting bash.

Once you've discovered which file is causing the problem then you can discover which part is the problem using a "halving method". Cut the file approximately in half and move that half back. That will tell you which half is doing it. Repeat with the cutting in half and moving until you have it down to a few lines or so you can then ask your question again.