Skip to content

Instantly share code, notes, and snippets.

@atika
Last active November 13, 2023 14:05
Show Gist options
  • Save atika/2766a42131a5cd1896f0 to your computer and use it in GitHub Desktop.
Save atika/2766a42131a5cd1896f0 to your computer and use it in GitHub Desktop.
Open the iOS Simulator folder containing -user defaults- plists files for your Application
#!/bin/bash
appname="$1"
[ -z $appname ] && read -p "Application name : " appname
apppath=$(find ~/Library/Developer/CoreSimulator/Devices/ -name "$appname.app" -print -quit)
if [[ ! -z $apppath ]]; then
echo "Found path for $appname app"
echo -e "\033[1;30m$apppath\033[0m"
appbundle=$(osascript -e "id of app \"$apppath\"")
plists=$(find ~/Library/Developer/CoreSimulator/Devices/ -name "$appbundle.plist" -print -quit)
if [[ ${#plists} -gt 0 ]]; then
echo -e "\033[1;32mUserDefaults found for $appname, open folder with finder.\033[0m"
while read line; do
/usr/bin/open $(dirname "$line")
done < <(echo "$plists")
else
echo -e "\033[31mNo UserDefaults plist found for $appname\033[0m"
fi
else
echo -e "\033[31mNo application found by that name: $appname.app\033[0m"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment