CantPaste

Problem: I can’t paste text from other applications into TextMate vice versa.

Solution: This is a system bug and can be solved by restarting the system pasteboard server:

killall pbs
nohup /System/Library/CoreServices/pbs &

After having killed pbs you need to relaunch affected applications. If the problem persists, re-login to your account or reboot.

(source: the ronge blog and Mac Geekery)


Question: Why does this only happen in TextMate?

Answer: It does not only happen in TextMate, but because copy/paste is such a frequent action in TextMate, it is over-represented among “affected applications”.

Question: Why then are my other applications not affected? I can still cut&paste properly to Terminal, Mail and others when TextMate stops working! Seems very strange.

Answer: pbs is a demon process which talks to running applications by means of interprocess communication. This demon is used to interchange clipboard data between applications, that is, TextMate tells pbs that is has clipboard data, or it asks pbs for what is currently on the clipboard.

It is the link between this (pbs) demon process and some random application (TextMate in the above) which “goes dead”, so effectively TextMate is locked out of clipboard sharing.

Relaunching TextMate is normally not enough, since pbs will not see the new instance (it probably thinks it is still talking to the old instance), but relaunching pbs tend to work because then all links are recreated.

But really, you will have to talk to Apple to get the real details on how these things work, TextMate uses NSPasteboard for all clipboard activity, which abstracts away these low-level details.