Useful macOS defaults: Simulator

The Simulator that comes with Xcode uses two domains:

After changing these, quit and reopen the Simulator.

Set the default device

Set which device the Simulator opens by default. It is easier to do this through the Simulator menu (File, then Open Simulator, then pick a device), but you can read the current value:

defaults read com.apple.iphonesimulator CurrentDeviceUDID

Window size and scaling

When a Simulator window opens, it may be very large on a small screen. You can set the default scale through the Window menu in the Simulator, or by using keyboard shortcuts:

There is no clean defaults key for the initial window scale. The Simulator remembers the last scale per device.

Show device bezels

Turn off the device frame (the picture of the phone around the screen) for a cleaner window:

defaults write com.apple.iphonesimulator ShowChrome -bool false

To bring the device frame back:

defaults write com.apple.iphonesimulator ShowChrome -bool true

You can also toggle this with Window, then Show Device Bezels.

Stay on top

Keep the Simulator window in front of other windows:

defaults write com.apple.iphonesimulator AllowFullscreenMode -bool true

You can also set this through Window, then Stay on Top.

Slow animations

Slow down all animations in the Simulator to debug timing issues:

defaults write com.apple.iphonesimulator SlowMotionAnimation -bool true

Or toggle it with Command T in the Simulator. Set to false for normal speed.

Screenshot location

Set where Simulator screenshots are saved (Command S):

defaults write com.apple.iphonesimulator ScreenShotSaveLocation -string "~/Desktop/SimulatorScreenshots"

Make sure the folder exists. By default, screenshots go to the Desktop.

Connect hardware keyboard

Use your Mac keyboard as the Simulator's keyboard (instead of the on-screen software keyboard):

defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool true

This is on by default. Set to false to always show the software keyboard.

GPU acceleration

Force the Simulator to use GPU rendering:

defaults write com.apple.iphonesimulator EnableMetalRendering -bool true

This is usually on by default on supported Macs.

Simulator command-line tools

You can also control the Simulator from the command line with xcrun simctl:

# List all available simulators
xcrun simctl list devices

# Boot a simulator
xcrun simctl boot "iPhone 15 Pro"

# Open the Simulator app
open -a Simulator

# Take a screenshot
xcrun simctl io booted screenshot ~/Desktop/screenshot.png

# Record video
xcrun simctl io booted recordVideo ~/Desktop/recording.mp4

# Install an app
xcrun simctl install booted /path/to/app.app

# Open a URL in the simulator
xcrun simctl openurl booted "https://example.com"

# Erase all content and settings
xcrun simctl erase all

# Delete unavailable (old) simulators
xcrun simctl delete unavailable

Read all current Simulator settings

defaults read com.apple.iphonesimulator
defaults read com.apple.Simulator

Notes

The Simulator stores per-device data in ~/Library/Developer/CoreSimulator/Devices/. Each simulated device gets its own folder with a unique identifier. You can find large Simulator data here if you need to free up disk space:

du -sh ~/Library/Developer/CoreSimulator/

To free space, delete old simulators you no longer use:

xcrun simctl delete unavailable

Enjoyed this post?

Well, you could share the post with others, follow me with RSS Feeds and/or send me a comment via email.


Tags

Category:

Year: