Accidentally removed pbcopy I messed up pbcopy. Instead of

 cat foo | pbcopy


I did

  cat foo &gt; pbcopy


And now my pbcopy is a text file. How can I reinstall it? Is it a part of some specific package, maybe something in homebrew?
Unless you ran these commands in the directory /usr/bin, and with root privileges, you have not overwritten the real pbcopy - you've simply created a new file in your current working directory with the same name.

So - you most likely do not have to reinstall pbcopy. To verify, you can call the full program explicitly, like this:

cat foo | /usr/bin/pbcopy


which should work properly. If it does, you can delete the pbcopy you inadvertently created safely...