Skip to content

Instantly share code, notes, and snippets.

@trilliwon
Created December 12, 2021 06:50
Show Gist options
  • Save trilliwon/825124bdcf74d6a6de2b16d2fe2b1c40 to your computer and use it in GitHub Desktop.
Save trilliwon/825124bdcf74d6a6de2b16d2fe2b1c40 to your computer and use it in GitHub Desktop.

How to take a screenshot and record a Video in iOS Simulator in Terminal

  1. Open iOS Simulator
  2. Open Terminal.app
  3. Run below script to take a screenshot
xcrun simctl io booted screenshot 1r.png
  1. Run below script to record a video and press CTRL + C to stop
xcrun simctl io booted recordVideo appPreview.mp4

Additional commands

xcrun simctl list
xcrun simctl addmedia booted ~/Desktop/sample.png
xcrun simctl list | grep Booted # list booted simulators
xcrun simctl shutdown $UUID
xcrun simctl erase $UUID
pbcopy ~/Desktop/sample.txt
xcrun simctl pbpaste booted
xcrun simctl openurl booted "https://developer.apple.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment