MacKuba

🍎 Kuba Suder's blog on Mac & iOS development

Testing Retina images on an older Mac

Categories: Cocoa, Mac Comments: 2 comments

Update 7.12.2020: Added info at the bottom about a UserDefaults setting you can use instead.

If you build iOS apps, you’re used to providing all icons and other images in @1x and @2x versions for older and Retina screens respectively (or rather @2x and @3x now). And it’s pretty easy to test if all those versions work or not, by starting the right iOS simulator and looking at it scaled to 100%.

If you work on Mac apps, you should also include @2x images for Retina Macs now; but if you’re like me, you might have treated that so far as something not urgent that can be done later…

When you do get around to that, if you don’t have any Retina Mac yet, you’ll quickly notice a problem: how do you test your app on a Retina screen? There’s no OSX simulator in Xcode, after all.

Fear not, turns out there is a tool that lets you turn your Mac into a Retina MacBook simulator, it’s just pretty well hidden.

First, go to the Downloads page on developer.apple.com and find the latest “Graphics Tools for Xcode” package on the list (you might find many versions, but the latest should be on the first or second page – right now it’s the Xcode 6.1 version from Oct 2014). This includes various thingies that were distributed with Xcode before and could be found in /Developer, but now were removed from the main bundle.

Graphics Tools for Xcode - Xcode 6.1 - Oct 16, 2014

Open the DMG and run the Quartz Debug tool (you don’t need to extract it anywhere, you only need to do this once). It will show you a small HUD window, but ignore it and instead open the “UI Resolution” panel that you can find in the Window menu:

UI Resolution - Enable HiDPI display modes

See that checkbox? Yeah, you need to check it. And unfortunately you’ll need to either log out and back in or restart your computer for this to work. You can close Quartz Debug and you can even delete the DMG (though some of the other tools there might be useful too, e.g. Icon Composer).

When you’re back, open the standard Displays panel in the System Preferences, and you should see at least one additional resolution on the list – this will be a special @2x mode that runs at half your normal resolution:

Resolution: Scaled 960 × 540 (HiDPI)

When you select that, your desktop will look a bit funny and you’ll have much less space, but you’ll be able to see which of the icons and controls adapt to a Retina screen properly. This is the result of doing this on my iMac (it turned the standard 1920×1080 resolution into 960×540@2x):

It does work on smaller screens too, but the effective resolution gets really small so it’s not as comfortable; here’s a screenshot from my MacBook Air at 720×450@2x (as you can see, Xcode is not terribly usable at such resolution :).

BTW, prepare to feel confused for a few minutes after you switch back – the cursor movement and animation will feel slower and so on :) All the windows will also stay resized to much smaller dimensions, and iPhoto might start complaining about having to generate @2x thumbnails (it’s probably better to not have it running while you’re doing this).


Update 7.12.2020: Turns out that there is also a secret UserDefaults setting that you can set in the terminal that lets you enable the HiDPI modes without installing any additional tools:

sudo defaults write /Library/Preferences/com.apple.windowserver.plist \
  DisplayResolutionEnabled -bool true

You still need to restart the computer for this to take effect.

2 comments:

Phil

Dear Kuba,

I'm hoping you might be able to help me- I fear that I am no longer able to access the hive web wallet- is this true??

Please will you respond to tell me if it's true?

Thanks,
Phil

Kuba

Hi,

I wasn't involved in the web version's development, I only worked on the Mac app which is completely independent (but also not maintained anymore, though it works by itself for now). So I only know as much as I saw on Slack etc.

As far as I know, everything's shut down now. You should be able to restore the wallet in Breadwallet which uses the same passphrase format - I did that myself just yesterday to move some remaining coins I had in the iOS wallet elsewhere. If you don't use iOS then there are probably other tools or wallets that you can use, but I don't know which exactly. In any case, if you have the passphrase, you won't lose the coins, it just might take some work to access them again.

Leave a comment

*

*
This will only be used to display your Gravatar image.

*

What's the name of the base class of all AppKit and UIKit classes?

*