Search code examples
cmacoscocoainstallationsdl

Custom binary runs at low DPI when packaged in .app on macOS


I've created an SDL2 application that has high DPI support and displays correctly when running the compiled binary manually.

I've created a .app structure (Info.plist, Contents/..., etc...) with the compiled binary inside. The app itself launches and runs fine, the problem is that despite adding NSHighResolutionCapable to my Info.plist the window is presented with a low DPI, contrasting the DPI when launching the compiled binary without the app structure. The Get Info menu displays the Open in Low Resolution option as ticked and greyed out, I have not touched this option.

Unless there are further steps for macOS app packages required, I can confirm that there is nothing wrong with the binary itself as it runs at high DPI when ran manually.

Below is a snippet of my Info.plist, I've redacted a chunk of irrelevant keys for readability sake.

[...]
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>NSHighResolutionCapable</key>
<true/>

What changes should do I need to make for running at high DPI?


Solution

  • I was lead in the right direction by TheNextman, it was the simple issue that a previous version of the Info.plist was cached before I added the high DPI key.

    To update the cache I entered the command /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f [path to .app] as explained here.