API to get the system pointer’s actual rendered size (respecting Accessibility → Pointer size)?

I'm positioning a tooltip-style panel relative to the mouse pointer and need to avoid overlapping the pointer glyph itself. This works fine at the default pointer size, but breaks once the user sets System Settings → Accessibility → Pointer → Pointer size to something larger than Normal — the pointer is visibly bigger on screen, but my offset doesn't grow to match, so the tooltip overlaps it.

The only cursor-size-related value I've found any API expose is the ratio behind that same setting, read via:

/usr/bin/defaults read com.apple.universalaccess mouseDriverCursorSize

This returns a scale factor (1.0 = Normal, larger toward Large), not a size in points. I'm using it to scale a fixed offset, but that only approximates the real on-screen footprint of the pointer glyph — it doesn't tell me the glyph's actual rendered bounding box, so the tooltip still clips the pointer at larger sizes.

Question: Is there a supported API — AppKit, Accessibility, or otherwise — that returns the system pointer's actual rendered size (bounding box, in points) reflecting the user's Pointer size setting? Or is there a different recommended approach for positioning UI relative to the live pointer without overlapping it, that doesn't depend on knowing that size directly?

Minimal repro (AppKit, Swift Package Manager, no storyboard/xib — ~150 lines):

enum CursorPrefs {
    static func readPointerScale() -> Double {
        let process = Process()
        process.executableURL = URL(fileURLWithPath: "/usr/bin/defaults")
        process.arguments = ["read", "com.apple.universalaccess", "mouseDriverCursorSize"]
        let outputPipe = Pipe()
        process.standardOutput = outputPipe
        process.standardError = Pipe()
        try? process.run()
        process.waitUntilExit()
        let data = outputPipe.fileHandleForReading.readDataToEndOfFile()
        let output = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
        guard let scale = Double(output), scale >= 1.0 else { return 1.0 }
        return scale
    }
}
// A tracking-area view shows a tooltip-style NSPanel near NSEvent.mouseLocation,
// offset by a fixed amount scaled by the value above. At Pointer size = Large,
// the tooltip still overlaps the (visibly bigger) pointer glyph, because the
// value is a ratio, not the glyph's rendered size in points.

Steps to reproduce:

  1. Run the demo app (swift run, or open Package.swift in Xcode and Run).
  2. Open System Settings → Accessibility → Pointer → Pointer size and set it to Large.
  3. Quit and relaunch the demo (it reads the setting once at launch).
  4. Move the mouse over the gray box in the window.
  5. The floating tooltip tracks the pointer but still overlaps the now-larger pointer glyph.

Environment: macOS 14.7.8 (23H730, Xcode 16.2 (16C5032a), Swift 5.9, arm64 (Apple Silicon).

Happy to attach the full repro project as a zip if useful — it's a single main.swift plus an SPM manifest, no external dependencies.

Answered by DTS Engineer in 917522022

Thanks for testing image.size as a live tooltip offset, with both linear and square-root scaling. In macOS 27.0.1, NSCursor reports the same hot spot and the same arrow image, 28 x 40 points, at each pointer size I tried. The visible pointer grows, but those values don't.

There isn't an API that reports the pointer's rendered size or the pointer size setting. NSCursor provides your app's cursor image and hot spot. The accessibility display options on NSWorkspace, such as accessibilityDisplayShouldIncreaseContrast, don't include pointer size. The com.apple.universalaccess default isn't API.

Standard tooltips do account for the setting. I gave a view a toolTip and measured where AppKit placed the tooltip. Its top edge sat about 19 points below the pointer's hot spot with Pointer size at Normal, and about 73 points below at Large. The tooltip didn't overlap the pointer at any size I tried. If your content fits in a standard tooltip, set toolTip on the view, or use addToolTip(_:owner:userData:) for an area within it. I tested in macOS 27.0.1 and haven't checked macOS 14.

If a standard tooltip doesn't do what you need, please file an enhancement request using Feedback Assistant so that your request can be seen by the appropriate decision makers. Describe the panel you're positioning and why a standard tooltip doesn't cover it. If you file the request, please post the Feedback number here so we can make sure it gets routed to the right team.

Please note that filing an enhancement request does not guarantee Apple will add any requested functionality to Apple products in the future. However, with that said, filing an enhancement request is a good way to get your ideas in front of the folks who make decisions about that sort of thing.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

You definitely don't want to call out to a separate process. You can get this value from UserDefaults.standard.persistentDomain(forName: "com.apple.universalaccess"). Combine that with NSCursor.current.image.size to get the visible size.

However, this isn't really an API. The old army joke goes, "If the army had wanted you to have a wife, we would have issued you one." Apple is the same. If Apple had wanted you to have a given piece of data, they would have given you an API. If you have to use hand-coded string, and query values that aren't documented and don't have enum definitions, you're taking a risk.

That being said, it does seem to work, and in a sandboxed app no less. But it looks like it would be forbidden in the Mac App Store. Any use of UserDefaults requires a privacy manifest for NSPrivacyAccessedAPICategoryUserDefaults and there isn't an entry in the reasons list for reading accessibilty settings.

Personally, I wouldn't bother with it. Don't forget the corrolary to the previous joke, "If Apple really cared about accessibility, they would have given you a decent API".

Thanks for the pointer — I tried it out and wanted to share what I found, since it doesn't actually hold up as a way to get the visible size.

I wired image.size × scale directly into a tooltip's on-screen offset (rather than just comparing the two numbers side by side) so I could see the result against the real pointer, not just estimate it. As a plain linear multiplier it badly overshoots: at Pointer size = Large (mouseDriverCursorSize = 4.00), the tooltip lands well past the pointer, not just clear of it.

That made me wonder if mouseDriverCursorSize is meant as an area ratio rather than linear, so I tried image.size × sqrt(scale) instead. That looked right at scale 2.00 and 4.00 — the tooltip cleared the pointer cleanly. But back at scale 1.00 (Default, where sqrt(scale) is 1, so the offset is just the raw image.size), the tooltip sits noticeably too far from the now-small pointer. So image.size by itself already overestimates the glyph's true visible footprint — probably padding baked into the asset bounds — independent of the scale question entirely. The sqrt result at larger sizes may just be that same baseline error becoming proportionally less visible as the offset grows, not a real fix.

So as far as I can tell: raw image.size, image.size × scale, and image.size × sqrt(scale) are all off by varying, inconsistent amounts across the Pointer size range — none of them reliably track the glyph's actual rendered bounding box. Which leaves the original question open: is there a supported way to get that, or a different recommended approach entirely for positioning UI relative to the live pointer without overlapping it?

(Also still true what you flagged: even if one of these numbers were right, reading it via UserDefaults would need a Privacy Manifest entry that doesn't currently have an approved reason covering this use — so it's a dead end for Mac App Store distribution either way.)

Thanks for testing image.size as a live tooltip offset, with both linear and square-root scaling. In macOS 27.0.1, NSCursor reports the same hot spot and the same arrow image, 28 x 40 points, at each pointer size I tried. The visible pointer grows, but those values don't.

There isn't an API that reports the pointer's rendered size or the pointer size setting. NSCursor provides your app's cursor image and hot spot. The accessibility display options on NSWorkspace, such as accessibilityDisplayShouldIncreaseContrast, don't include pointer size. The com.apple.universalaccess default isn't API.

Standard tooltips do account for the setting. I gave a view a toolTip and measured where AppKit placed the tooltip. Its top edge sat about 19 points below the pointer's hot spot with Pointer size at Normal, and about 73 points below at Large. The tooltip didn't overlap the pointer at any size I tried. If your content fits in a standard tooltip, set toolTip on the view, or use addToolTip(_:owner:userData:) for an area within it. I tested in macOS 27.0.1 and haven't checked macOS 14.

If a standard tooltip doesn't do what you need, please file an enhancement request using Feedback Assistant so that your request can be seen by the appropriate decision makers. Describe the panel you're positioning and why a standard tooltip doesn't cover it. If you file the request, please post the Feedback number here so we can make sure it gets routed to the right team.

Please note that filing an enhancement request does not guarantee Apple will add any requested functionality to Apple products in the future. However, with that said, filing an enhancement request is a good way to get your ideas in front of the folks who make decisions about that sort of thing.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?