Skip to content

Instantly share code, notes, and snippets.

@ernestom
Created September 2, 2014 06:25
Show Gist options
  • Save ernestom/ec967d5512572207207e to your computer and use it in GitHub Desktop.
Save ernestom/ec967d5512572207207e to your computer and use it in GitHub Desktop.
Opens all the preferences plist files (NSUserDefaults) for the app in the current directory.
#!/bin/sh
# The project name based on the workspace path, e.g. "MyProject" from "./MyProject.xcworkspace"
WORKSPACE_NAME=$(echo `find . -name *.xcworkspace -type d -exec basename {} \;` | cut -d'.' -f1)
SIMULATOR_PATH="$HOME/Library/Application Support/iPhone Simulator"
# The App's bundle ID taken from its info plist, e.g "com.myproject" from "./MyProject/MyProject-Info.plist"
BUNDLE_ID=`/usr/libexec/PlistBuddy -c Print:CFBundleIdentifier $WORKSPACE_NAME/$WORKSPACE_NAME"-Info.plist"`
# Open all plist files in the simulator path that match the app's bundled ID
# normally one per iOS version
find "$SIMULATOR_PATH" -name $BUNDLE_ID".plist" -type f -print0 | while IFS= read -r -d '' PLIST; do
echo $PLIST
open "$PLIST"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment