7

In the past few months, I have been unable to paste text into XCode.

I can paste from xcode to xcode.

I cannot paste from anywhere else. The cursor moves the amount of characters that are supposed to be pasted, but nothing is actually pasted.

Sometimes, some of the text is pasted, but the formatting is all messed up.

Anyone have any ideas? Tried both Xcode 6.2 beta and Xcode 6.1.1

Thanks!

  • I have the same problem and noticed this started working when I tried to debug an open source version of Jumpcut, and then realized this happens to Xcode any time I am using an app which manipulates the Mac OS clipboard. – leolobato Apr 1 '15 at 1:59
  • This clipboard-related Xcode bugs drive me mad. Can't paste text copied from other programs neither to console nor to text area. Restarting Xcode doesn't help. Interesting thing: copying from Chrome works, copying from TextEdit, Sublime or even pbcopy does not. Copying between TextEdit, Sublime, etc. works well. – cubuspl42 Apr 1 '15 at 16:33
  • Did you tried deleting Xcode configuration files on ~/Library/Developer/Xcode/ and start over? – jherran Apr 4 '15 at 13:41
2
+50

A few things to check:

1) That you're using the correct command-line developer tools. (newer versions of Xcode 6.2+ rely on these for things like SourceKit etc..)

You can check this by running xcode-select -p in terminal, and you should get back something to the tune of /Applications/Xcode.app/Contents/Developer or the path to whichever beta you're using i.e. /Applications/Xcode-beta.app/Contents/Developer

2) Don't rename the beta-s i.e. '/Applications/Xcode-beta.app' to '/Applications/Xcode-6.2-beta4.app'. Things go awry with this!

3) Is your pboard working in general?

Drop to terminal and:

  • ps -ef | grep pboard

should come back with something such as:

504 367 1 0 2:20pm ?? 0:00.01 /usr/sbin/pboard

if it doesn't, double confirm that it's set up to be launched properly by:

launchctl list | grep pboard

this should come back with something like:

367 0 com.apple.pboard

Note the 367 shown in both for the PID. This basically indicates that my pboard is running fine...

If you get something else try:

cat /System/Library/LaunchAgents/com.apple.pboard.plist

and you should get something like:

...
<plist version="1.0">
    <dict>
        <key>POSIXSpawnType</key>
        <string>Interactive</string>
        <key>Label</key>
        <string>com.apple.pboard</string>
        <key>ProgramArguments</key>
        <array>
            <string>/usr/sbin/pboard</string>
        </array>
        <key>MachServices</key>
        <dict>
            <key>com.apple.pasteboard.1</key>
            <true/>
        </dict>
        <key>EnableTransactions</key>
        <true/>
    </dict>
</plist>

4) When you paste into Xcode, and you get the spaces (i.e. missing characters), when immediately save the document, is the text there after restarting Xcode and reloading the project?

5) If you open Console in (Applications/Utilities/) do you see anything specific flashing up when you paste? i.e. any Xcode, DVT, SourceKit, Pboard etc... assertion errors etc.. - try pasting whilst console is open so you can see this. - (the above tags I listed should be good filter words for console)

Let us know if this helps :)

  • I've opened the console and I see a bunch of "07/04/15 18:13:17,596 Google Chrome[1585]: Can't allocate a new block for a pasteboard. Creation of a new Pasteboard will fail." messages. Looking up, this might be a Pushbullet sync issue! I haven't tested disabling it yet, but I will soon and will mark this answer as correct if it solved it! – leolobato Apr 8 '15 at 1:14
  • I see this is a previous bug posted on the chromium pages: code.google.com/p/chromium/issues/detail?id=467296 – Adrian Sluyters Apr 8 '15 at 15:47
  • Hope it helps, but I'm Apple through and through, so avoid anything other than Apple designed software :) – Adrian Sluyters Apr 8 '15 at 15:47
  • Just to confirm: Pushbullet was the issue. I've disabled "universal copy & paste" and the problem is now gone for days. – leolobato Apr 14 '15 at 23:27
1

Perhaps not a solution, but a workaround.

How about using Kill & Yank instead?

Ctrl ⌃ K to cut/kill
Ctrl ⌃ Y to paste/yank

It differs from copy/paste in that if you have no text selected, it will kill to the end of the current paragraph by default.
There's no equivalent to Copy, if you want to keep the text you just killed in its original location you have to yank it back into its original place first, or Undo.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .