This question already has an answer here:
Very often, on my Mac, when I use the pipe (|) character followed by a space character, an invisible character will be inserted in between.
This is especially annoying when using the terminal, as it makes commands invalid.
If I type the following in iterm2, I often get the following:
ls | cat zsh: command not found: cat
If I hit the up-arrow-key to get my previous command, and then remove and reinsert the space between
cat, the command will work.
When I copy paste the working and non working commands into a file, like this:
non-working: ls | cat working: ls | cat
and open it in Hex Fiend it shows the following:
non-working: ls |¬†cat working: ls | cat
I've also experienced the same kind of issue in SublimeText2 using the square brackets () followed by a space. So I don't believe its an issue with iTerm2.