Sometimes checking your instagram during work is kind of strange, so why not check your instagram inside your terminal? OK… I know checking this during work is still strange… 😑 To be honest, I did this just for pure fun.
Related: Recently bumped into this basic instructional video to get WordPress up and running using a Docker setup containing a Caddy, Apache2/PHP7 and a MySQL container. Good one if you’re looking to get started with Docker.
Wasn’t aware of this, but turns out one can control (and interact with) the iOS Simulator straight from the command line.
There’s no need to install anything new though. The tool we’re going to be using is already on our Mac, hiding inside the xcrun command, which gets installed with Xcode.
It’s called simctl.
Here’s a few examples:
# open a URL
xcrun simctl openurl booted "https://littlebitesofcocoa.com"
# upload an image to the iOS Simulator
xcrun simctl addmedia booted ~/images/image1.png ~/images/image2.jpg
# Take a screenshot
xcrun simctl io booted screenshot ~/Desktop/screenshot.png
# Record a video
xcrun simctl io booted recordVideo --type=mp4 ~/Desktop/movie.mp4
Other commands include booting/stopping a device, clipboard operations, launching/terminating processes, installing/uninstalling apps, etc. — No touch events though, that would’ve been real fun.
Sidenote: digging a bit deeper into this I stumbled upon fbsimctl. Their features are quite the same which makes me wonder if fbsimctl uses simctl underneath its hood, or if simctl came later and copied features from fbsimctl.