With a dark color scheme in Xcode 4 the i-beam cursor (aka text selection cursor) is nearly invisible. Is there a way to change the color of this cursor, either for Xcode specifically, or failing that, system-wide?
It'd be nice if it would automatically change to a color contrasting its background too.
At the bottom of the right-hand area, click "Additional mouse options". In the Mouse Properties dialog that opens, click the Pointers tab. In the list, click "Text Select" and then click the Browse button. In the Browse dialog you'll find a large selection of mouse cursors to choose from.
You'll need to work with NSCursor to create a custom cursor. The cursor needs an NSImage as it's look and an NSPoint as the cursors hot spot. The NSImage could be loaded from an image or create manually. You can add this in the viewDidLoad method of your ViewController.
On your Mac, use the Pointer pane of Accessibility Display preferences to change the size and color of the pointer to make it easier to find on the screen. To change these preferences, choose Apple menu > System Preferences, click Accessibility , click Display, then click Pointer.
The I-beam pointer cannot be disabled or removed in a word processing program or text editor. However, when you start typing, the pointer does disappear by itself. If the pointer re-appears or is annoying, move the pointer off-screen as you type or when it's not needed.
As of Xcode 8, Apple has hidden the i-beam cursor somewhere where nobody has found it. Instead, many have chosen to use Mousecape to alter the i-beam in all programs. I prefer that method since it fixes the i-beam in other programs that support dark themes, such as Komodo editor. Mousecape should work in all Xcode versions and updating Xcode won't break the cursor. I'm currently using Mousecape in macOS 10.13.2, Xcode 9.1. Here are the steps:
Mousecape.app
File > Import Cape > "cape" file downloaded above
Apply
Mousecape > Install Helper Tool
Original answer:
Xcode does NOT use the system-wide i-beam cursor as everyone I found talking about it stated as if it was a known fact. If I hadn't believed those people, I wouldn't have spent two days figuring out how to alter the system i-beam cursor by editing CoreGraphics only to find that Xcode's ibeam doesn't change. BTW, I also stumbled on how to edit other system cursors.
I spent most of a weekend figuring this out, but the i-beam cursor in Xcode CAN be edited. It's simply a TIFF file in the following location for Xcode 3.2.6 (and earlier, I assume, but have not tested):
/Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/TIbeam.tiff
Xcode 4.1 has the same file but it does not affect the i-beam in the main editor (I assume it's used somewhere, but maybe not). Instead, the main editor in Xcode 4.1 uses this file:
/Developer/Library/PrivateFrameworks/DVTKit.framework/Versions/A/Resources/DVTIbeamCursor.tiff
The ibeam files have moved again in Xcode 4.4:
/Applications/Xcode.app/Contents/OtherFrameworks/XcodeEdit.framework/Versions/A/Resources/TIbeam.tiff
/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/DVTIbeamCursor.png
/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/[email protected]
Editing DVTIbeamCursor.png was enough to change the i-beam in the main editor on my system. On another site, someone reported that [email protected] will be used on a retina display or Apple's other new high res displays like Thunderbolt and Cinema. Who knows if TIbeam.tiff is even used anymore since they didn't update it to png.
According to comments below, in Xcode 5.0.2 all 3 cursor files were replaced with one file:
/Applications/Xcode.app/Contents/OtherFrameworks/XcodeEdit.framework/Versions/A/Resources/DVTIbeamCursor.tiff
And in 5.1.1 (boy, they sure love to change things in almost every version, don't they?):
/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/DVTIbeamCursor.tiff
I'm guessing that file is a double resolution (aka retina display) cursor that's scaled down for non-retina screens.
If you can't find the ibeam file in your Xcode, try running this command in Terminal:
sudo find / -name 'Ibeam' -print
In Xcode 7.3, the cursor was moved inside the following bundle file so the search command above won't find it:
/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/Assets.car
I recommend using a process found here to patch a new cursor into the bundle file. If you don't like the cursor it installs (I felt it was still too dark and the grey outlines blend in with grey comment text), follow these steps:
/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Assets.car
Assets.car
somewhere where it can be edited, such as to ~/Documents/Assets.car
.Theme Engine.app
, click Open Document
, then open ~/Documents/Assets.car
.DVTIbeamCursor
.Assets.car
back to /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Assets.car
and keep a backup copy of your modified version somewhere so you don't have to do this again until a new Xcode version changes what's in Assets.car
.You may also wish to send an angry letter to Apple to complain that they have not fixed this problem in the last 7+ years and have instead made it progressively more difficult for users to patch Apple's broken cursor.
Don't forget to keep backups of your edited cursors. Newer Xcode versions will overwrite your custom cursors with default ones when it does a software update.
Here's the ibeam cursor I use: Right click the ibeam and choose to save the image to get the png version, or click here to download the tiff version.
If you're making your own cursor, notice that where the black lines intersect in the original cursor is where the white lines intersect in my cursor. That's because the original cursor was meant to be used on a white background, so its black part is where the cursor hotspot is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With