I had a similar problem. It turned out that my problem was with the installation of the iTerm shell. Since you noted the question [osx], I guess you could do that too.
There is a good explanation of what these strange characters mean in this answer: https://unix.stackexchange.com/a/294886/47407
I decided that I would not be able to remove Shell Integration by clearing my PROMT_COMMAND and installing PS1 again. I created a shell script called pycharm_terminal.sh with the following
export PROMT_COMMAND= export PS1="\[\e[31m\]\u\[\e[0m\] at \[\e[33m\]\h\[\e[0m\] in \[\e[32m\]\w\[\e[0m\] at [\A] \[\033[31m\]`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\[\033[35m\]\n$ \[\033[00m\]" bash -i
The PS1 variable can be set to everything that was before. This is what I like.
Now, in PyCharm’s settings: go to “Tools”> “Terminal” and in the “Shell Path” set the value /bin/bash <path_to_pycharm_terminal.sh> .
Now try opening a new terminal in PyCharm. It should not have these symbol control errors.
source share