pbcopy exits code 1, no error message I'm trying to use pbcopy and pbpaste to copy and paste to the clipboard from a shell. I read the man page to learn the syntax for these programs. However, no matter how I try to invoke pbcopy or pbpaste, they refuse to work, exiting code 1 with no error message. Command-C and Command-V work as normal.

[jay-mba-osx ~]% echo foo | pbcopy                                                                                                                                          
[jay-mba-osx ~]% echo $?                                                                                                                                                    
1
[jay-mba-osx ~]% pbcopy &lt; foo.txt                                                                                                                                        
[jay-mba-osx ~]% echo $?                                                                                                                                                    
1
[jay-mba-osx ~]% echo foo | pbcopy -pboard general                                                                                                                          
[jay-mba-osx ~]% echo $?                                                                                                                                                    
1
[jay-mba-osx ~]% pbcopy --help                                               
[jay-mba-osx ~]% echo $?
1
[jay-mba-osx ~]% which pbcopy                                                                                                                                               
/usr/bin/pbcopy
[jay-mba-osx ~]% pbpaste                                                                                                                                                    
[jay-mba-osx ~]% echo $?                                                                                                                                                    
1


Any ideas why this is happening? It persists across reboots.

EDIT: OS X 10.9 Mavericks. Here is the result of uname -a:

Darwin jay-mba-osx.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64


EDIT2: I have isolated this to occur only in tmux sessions. I didn't even think about that at first... now to figure out the actual problem...
It is a problem with tmux detaching itself from the GUI namespace.

Fixed with: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard