No Such File (When Using Pipes) in MacOS Terminal

Using the German keyboard, I have to use a combination of the [Alt] modifier key and other keys to be able to print characters like brackets or the pipe symbol.

Using pipes in shell commands, sometimes this happens:

$> echo "foo" | wc -l
bash:  wc: command not found

Hm. Weird. “wc” should be present on this system. Let’s check:

$> which wc

Hm. So why isn’t this working?

Seems like my left thumb spent a few milliseconds too long on the [Alt] key… So instead of typing [space] (pipe) [space] I typed [space] (pipe) [Alt] + [Space])… hence the bash error.

If you’re using iTerm2 as your terminal app in MacOS (you really should give it a try!), the workaround is an easy one: in the settings (Preferences – Keys) you can set the keystroke “[Alt] + [Space]” to produce a regular space:


comments powered by Disqus