Skip to content

Instantly share code, notes, and snippets.

@DylanLacey
Last active May 19, 2016 08:32
Show Gist options
  • Save DylanLacey/8ef50aac28c7dc331f89 to your computer and use it in GitHub Desktop.
Save DylanLacey/8ef50aac28c7dc331f89 to your computer and use it in GitHub Desktop.
DoThePhotoThing
#!/bin/bash
#! /bin/bash
# Wait until the simulator is running before we try to add the file
simulator=$(ps aux | grep launchd_sim | grep -v grep)
while [ -z "$simulator" ]
do
echo Sleeping for 5
sleep 5
simulator=$(ps aux | grep launchd_sim | grep -v grep)
done
# Parse out the simulator in use
device=$(echo $simulator | sed -n 's_^.*/Users/.*/CoreSimulator/Devices/\([0-9A-Z-]*\).*_\1_p')
# Fetch the file
wget -P ./ http://i.imgur.com/58mXgoU.jpg
# Put it on the simulator
echo Upload file to simulator $device
/Applications/Xcode-6.1.app/Contents/Developer/usr/bin/simctl addphoto $device 58mXgoU.jpg
@netbrain
Copy link

@DylanLacey ok this works, but how do i remove the stock photos already present?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment