When opening terminal, this line shows every time:
-bash: :wq: command not found
How can I stop it from appearing every time Terminal opens ?
It looks like there exists a line
:wq in one of your shell’s profile files, such as
~/.bash_profile, which was probably added as a failed attempt at quitting Vim when editing such a file.
To edit the bash profile with TextEdit, run
open -e ~/.bash_profile in Terminal. Edit the file to remove the
:wq line only. Save it, quit TextEdit and restart Terminal to see changes. You might want to make a copy of the file in case you're worried:
cp ~/.bash_profile ~/.bash_profile.bak.
If you don’t want to use Terminal at all, see this answer How to add the PATH for mysql bin on Mac? with instructions on how to edit a profile file only using GUI.
You messed up when editing .bash_profile with the 'vi' editor aka 'vim'.
You did your writing in insert mode, then when you finished, you were supposed to hit
esc to exit insert mode, then
: w q for command, write and quit.
You failed to hit
esc so it inserted :wq as additional text. You then collected yourself, tried
esc : w q one more time, and that worked.
Fire up vim one more time, opening the file as before.
escbut do it anyway. It may beep.