23

Apple's Whats new in Xcode 9 states that we can record videos of Simulators. How to do that?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Shyam
  • 366
  • 1
  • 2
  • 10

2 Answers2

46

Taking a Screenshot or Recording a Video Using the Command Line:

  • Launch your app in Simulator.
  • Open terminal.

To take a screenshot, use the screenshot operation:

xcrun simctl io booted screenshot

To record a video, use the recordVideo operation:

xcrun simctl io booted recordVideo <VideoFILENAME>.<extension>

To stop recording, press Control-C in Terminal.

Note: It works only on Mac computers that support Metal . You can check your PC here.

Balasubramanian
  • 5,274
  • 6
  • 33
  • 62
  • Meh. It's easier to launch quicktime:) – Paweł Brewczynski Oct 03 '17 at 12:05
  • If you record the video this way, it's being saved to your user home folder. – balazs630 Nov 16 '17 at 19:31
  • 2
    @balazs630 it records to wherever you tell it to. If you just opened a terminal and the CWD is your home directory and you simply give a filename, then yes, it ends up in the home directory. But you if you've `cd`'d elsewhere or give it more of a path, the video will be where you told it to be. – Kevin Jan 24 '18 at 16:45
  • 1
    Any ideas how to include audio? Thanks in advance. – Jules Feb 08 '18 at 09:01
  • `-bash: syntax error near unexpected token `newline'` this error comes up when i use this – Reza.Ab May 30 '18 at 03:58
  • 1
    This works great! One thing I noticed was after repeated captures, the quality degraded and the captures became distorted. I think it might have been the OS paging during I/O or some such thing. I tried quitting the simulator but that didn't help. Rebooting my Mac fixed the issue and I was able to capture a clean video again. – One In a Million Apps Jan 07 '19 at 15:45
0

On iOS devices you can open control center settings and enable 'recorder' then open control center and tap the circle in circle in control center, to begin recording, when you are done it saves to your photo library. Hope this helps (hope this feature stays on the release version:])

Esyew
  • 11
  • 1