MacOS – Characters do not echo in OS X terminal unless I hit the delete key

bashmacos

As the title states, when I open up terminal to type a command, I cannot see what I am typing, it is as if the terminal is frozen. I can still execute commands when I hit return, I just cannot see what I am typing.

The weird part is that when I hit the delete key, I am suddenly able to see what I am typing, and the terminal functions normally until I run the command.

As well, when I hit delete the header at the top of the terminal window changes from:

name – bash – 80×24

to:

name – 37m – bash – 80×24

Any help would be greatly appreciated. Thank you

edit: Thanks for all the help, I've tried some of the suggestions. Creating a new Admin account and opening terminal seemed to do the trick; I can type in terminal in this new account without pressing delete. Any ideas for my main account?

Here is what I get when I run: /usr/bin/env

$/usr/bin/env
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/h5/rp872k9n0zq2lkl0kbbykjx00000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-KfwCn3/Render
TERM_PROGRAM_VERSION=326
TERM_SESSION_ID=F81718AA-A3FC-4FB9-9FF4-00037406DBAF
USER=derekbogdanoff
SSH_AUTH_SOCK=/tmp/launch-qQfC1a/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
__CHECKFIX1436934=1
PWD=/Users/derekbogdanoff
LANG=en_CA.UTF-8
PS1=$[\033]0;37m]
SHLVL=1
HOME=/Users/derekbogdanoff
LOGNAME=derekbogdanoff
_=/usr/bin/env

Best Answer

Your prompt is messed up, specifically PS1:

PS1=$[\033]0;37m]

that's missing a lot of escape characters (\e[) needed for the colors (and most useful parameters for a PS1). That's also why you get the 37m in the terminal window title. Try setting it to something different by running:

export PS1="\e[0;31m[\h:\W \u]\$\e[m "

and see if that works. It should give a red (thats \e[0;31m) prompt showing hostname (\h), current working directory (\W) and logged in user (\u) inside brackets [] and the bash exit status of the previous command (\$). Note that at the end the color is reset to the default of the session with \e[m .

If the above worked, you only have to find out from which configuration file your "bad" PS1 comes from: look for an "export PS1=" line in ~/.profile, ~/.bash_profile, ~/.bashrc, (as M K already suggested in his answer) and put in the above version.

There are a lot of answers around here with helpful colors codes and inputs for configuring the PS1, like this one for example.