macOS – ‘:wq’ Command Not Found

bashcommand linemacosterminal

When opening terminal, this line shows every time:

-bash: :wq: command not found

How can I stop it from appearing every time Terminal opens ?

Best Answer

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.