Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Finally! Here's the easy access to your iOS8 simulator apps you've been looking for :)
#!/bin/bash
#
# Using the information available in the new iOS8 simulator for each
# device/runtime (device.plist), this script creates a readable folder structure
# (no UDIDs, just simple device/runtime names). Inside that structure it creates
# soft links to your apps in development.
#
# You can run this script every time you install an app to your simulator, or
# you can simply call it to access this folder making sure it will always be
# updated :)
#
# Copyright (c) 2014 Ferran Poveda (@fbeeper)
# Provided under MIT License (MIT): http://choosealicense.com/licenses/mit/
# Help output
app_name=`basename $0`
if [ "$1" == "-h" ] ; then
echo "\n"$app_name" provides easy links to access your iOS simulator apps."
echo "Usage: `basename $0` [-h] [output path (default: ~/iOS Simulator Apps/)]\n"
exit 0
fi
# Build main directory
appsDir=${1:-"$HOME/iOS Simulator Apps"}
if [ -d "$appsDir" ];
then
rm -rf "$appsDir"
fi
mkdir "$appsDir"
# For each iOS+runtime device found
ios_configs=(`find $HOME/Library/Developer/CoreSimulator/Devices -maxdepth 1 -mindepth 1 -type d`)
for config in "${ios_configs[@]}";
do
# Make folder structure for them
metadata_file=""$config"/device.plist"
device_name=`defaults read $metadata_file name`
runtime_name=`defaults read $metadata_file runtime | awk -F"." '{print $NF}'`
location="$appsDir/$device_name/$runtime_name"
mkdir -p "$location"
# Make links to existing to your apps
find "$config" -name '*.app' | grep -v "DDActionsService\|MobileSafari\|StoreKitUIService\|Web.*app" | while read app ; do
app_name=`basename "$app"`
ln -s "$app" "$location/$app_name"
done
done
# Open the updated directory
open "$appsDir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment