Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm converting a shell script which xclip and similar tools on Linux, to use pbpaste and pbcopy on Mac. The problem is the default pasteboard ('general' according to the man-page) for these tools is not the one being used by Stickies / Safari / TextMate / all the GUI apps.

I've tried all the pasteboard names mentioned in 'man pbpaste' but none contain the data I copy in any GUI app. If I load data into the 'general' pboard using 'pbcopy' I can extract it fine via 'pbpaste' - but it's separate from the GUI pasteboard.

Note I'm not running any unusual shell, Terminal or WindowServer settings, this is standard 10.7 Terminal and bash.

share|improve this question
1  
I can't replicate this issue. pbcopy and pbpaste work fine for me using the methods that you specified. –  Nathan Jul 18 '12 at 15:41
    
Just tested on a second machine, and indeed it works fine. So it's something specific to my config on that particular box. Unfortunately I have no idea what - there's nothing unusual in .profile, or .bashrc –  James Turner Jul 18 '12 at 16:36
    
Could you share a minimal script that exhibits the problem? –  noffle Jul 18 '12 at 17:29
2  
This sounds like classic symptoms of the pasteboard server having died (e.g., apple.stackexchange.com/q/31866/22570 and similar), which seems fairly common on Lion. If you restart, does it work? –  Ken Jul 18 '12 at 18:30
add comment

3 Answers

Check your bash aliases - is something aliasing pbcopy/pbpaste to use one of the other pasteboards?

The manpage for these commands mentions four possible pasteboards that they can use - general, ruler, find, and font. Try pbcopy -pboard general to force it to use the general pasteboard.

share|improve this answer
    
Already tried those options - the commands are using the general pasteboard, but my GUI apps are using some other pasteboard, it seems. –  James Turner Jul 18 '12 at 16:34
add comment
up vote 2 down vote accepted

As suggested in one of the comments, the issue was a confused pasteboard server - a restart of that made everything work as expected.

share|improve this answer
    
It probably has not been 24 hours yet, but be sure to accept your own answer when possible! –  Jason Salaz Jul 20 '12 at 11:35
    
I have the same issue, how does one restart the pasteboard server? –  grebneke Feb 2 at 14:26
add comment

If you are using the command under tmux / screen, you need some settings. There're great post on this problem.

https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/README.md

share|improve this answer
    
Answers on Ask Different need to be more than just a link. It's okay to include a link, but please summarize or excerpt it in the answer. The idea is to make the answer stand alone. –  patrix Feb 18 at 14:48
    
"Answers on Ask Different need to be more than just a link." is the rule in this site? If so please give me the link referring to it as I'm pretty new here. I've posted this answer as it might be useful for who runs into the same problem that I had. And is already stand alone in another meaning as no other answer points it. –  9re Feb 18 at 15:52
    
Let's call it a good practice. Links may break over time rendering your answer useless, it will frustrate any future user if he thinks he has found the answer but only gets a 404 error back. That's why we expect answer to stand on their own (and reference the source if applicable). –  patrix Feb 18 at 19:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.