Can't comment selection

Solution 1:

Try this. Out of all the other suggestions, this was the only one that worked for me.

Go to your applications folder and rename Xcode to whatever you want, then open the Xcode. Check to see if the comment selection now works, if so, you can go back and rename Xcode to its default name. If not, rename Xcode back to its original name anyway, and continue searching for another solution.

This worked perfectly for me.

Solution 2:

None of the workarounds worked for me after installing xcode 8.1 beta. I finally found that moving the Xcode beta out of the applications folder into a different location (desktop is where i put mine) then running sudo usr/libexec/xpccachectl fixed the issues i was having.

Solution 3:

This is a known bug in Xcode 8 beta-4 (according to Apple, on "some systems", without specifying which ones).

The good news is, according to Apple they've fixed this in beta-5. From the release notes:

Resolved in Xcode 8 beta 5 – IDE

The Editor’s Comment/Uncomment Selection command is functional when enabled. (27524523)

The bad news is, it's still not working for me in beta-5, even after rebooting. And for the life of me, I can't figure out what they mean by "when enabled". Since when do you have to "enable" comment/uncomment, and how would you go about doing that?

I'm on a Mac Pro cylinder running El Capitan 10.11.6, editing Swift 2.3 code.

Solution 4:

On a German Macintosh Computer, there is a System keyboard shortcut overriding the Xcode comment section shortcut.

Simply deactivate the Hilfemenü anzeigen shortcut. (show help)

Conflicting Shortcut

Solution 5:

  1. Exit Xcode
  2. Type sudo /usr/libexec/xpccachectl in Terminal
  3. Restart Xcode
  4. Restart your Mac if needed

Source