Skip to content

Instantly share code, notes, and snippets.

@fbeeper
Created September 15, 2014 17:30
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save fbeeper/7d49768e0f075335e65c to your computer and use it in GitHub Desktop.
Save fbeeper/7d49768e0f075335e65c to your computer and use it in GitHub Desktop.
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