DEV Community


Recording iOS simulator and Android device screen

Sakari Mursu
・2 min read

At work I like to add gifs or screenshots to pull requests to make it easier for my fellow developers and designers to review the changes. Its easier to show something visual than to explain it in text. I find videos especially helpful when showing steps to reproduce some complex bug.

Gifs are great but sometimes they are not enough. For more longer and more complex things I wanted to figure out how take recording of iOS simulator and my Android test device screens. Have not had need for Android emulator recording yet.

Turns out you can record iOS simulator without any additional software but Android requires you to download a tool. I am using Macbook so these are MacOS specific findings.

Recording iOS simulator screen

For iOS recording simulator screen was pretty straightforward and it can be done via command line. I used to use Quicktime to record but once I found out about the cli command I have not used Quicktime. It is much more quicker to do a short recording versus Quicktime.

You can record iOS simulator from cli with

xcrun simctl io booted recordVideo

To stop recording interrupt the command with ctrl + c.

Recording Android device screen

Android is a bit more tricky and requires software to be installed. I found a tool called srcpy which offered a way to record Android screen. It also allows you to mirror your device's screen. That's really useful for remote demos!

You can record Android device screen from cli with

scrcpy --record file.mp4

To stop recording interrupt the command with ctrl + c.

I prefer to limit the size of the recoded screen size using -m size parameter. It makes the recording's max width or height be the given value (which ever goes above the maximum first).

scrcpy -m 720 --record file.mp4

Making life easier with bash aliases

As I have started to use these commands often I have made my life easier with these two aliases.

Adding these your ~/.bashrc, ~/.zshrc or other place where you keep your aliases allows you to record iOS simulator with record-ios <filename> and record-android <filename>.

# Record iOS simulator
#   $1: filename, e.g. `recording`
# To stop recording interrupt with `ctrl-c`
# Usage: `record-ios ~/Desktop/file`
function record-ios() {
  xcrun simctl io booted recordVideo $

# Record Android device (requires
#   $1: filename, e.g. `recording`
# To stop recording interrupt with `ctrl-c`
# Usage: `record-android ~/Desktop/file`
function record-android() {
  scrcpy -m 720 --record $1.mp4

Discussion (0)