Metal Toad has been building applications and cloud environments for some of the most well-known global brands for over a decade. Learn more > >

iOS: A Quick Script to Retain Your Sanity With CoreSimulator Folders.

Note: This is outdated. See our update for Xcode 7

When Xcode 6 was released this past fall, Apple switched from a relatively sane folder structure to a completely opaque GUID based structure. For debugging purposes, it’s often nice to be able to browse your app’s file structure in the simulator without resorting to NSLogging a device ID.

We wrote a quick script to eliminate that headache. It grabs the GUIDs for all CoreSimulator devices from the `instruments` command line utility, and makes nicely named symlinks in your Documents directory. When Apple inevitably adds or removes simulators, you can simply run the script again to regenerate the links.

Here’s the script

if [ -d $HOME/Documents/iOS\ Simulator\ Symlinks ]; then
  rm -rf ~/Documents/iOS\ Simulator\ Symlinks
mkdir ~/Documents/iOS\ Simulator\ Symlinks
xcrun instruments -s | grep 'Simulator' | while read -r line ; do
    left=`echo $line | sed -n 's/ \[.*\]//p'`
    left=`echo $left | sed -n 's/ /\\ /pg'`
    right=`echo $line | sed -n 's/.*\[\(.*\)\]/\1/p'`
    ln -s ~/Library/Developer/CoreSimulator/Devices/"$right" ~/Documents/iOS\ Simulator\ Symlinks/"$left"
Filed under:

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Ready to get started?