title: Command line access to iOS app directory (sandbox) from Mac
body: <p>I need to access the sandbox directory for an application installed on an iOS device, using the command line (non-gui) from a Mac or Linux.  This is to help with development and testing automation.  Dropping a json file into the sandbox lets me set parameters like extra debug messages and smaller refresh intervals.</p>
  
  <p>A tool like iFunBox works perfectly but is graphical only, requiring numerous clicks to do this.  Emails to the developers were unanswered.  It also does not support AppleScript. I did find another app that provided a Fuse module, but it turned out buggy especially if the app was uninstalled and then reinstalled (in order to reset back to first time user experience).  I reported the problems to the developer but there is no fix on the horizon.</p>
  
  <p>The things I need to do are:</p>
  
  <ul>
  <li>Test if an app with a specific bundle id is installed</li>
  <li>Create Library/Caches/MYLIBNAME directory if it doesn't exist</li>
  <li>Copy a ~100 byte json file from the Mac to that directory</li>
  <li>Get a copy of that file</li>
  <li>A solution that only works from Linux is acceptable too</li>
  <li>Devices are not jailbroken and I would prefer not to need that as a requirement</li>
  </ul>
  
  <p>In some cases I do not have the source code to the app since it is a third party using my library, so compiling different versions of the app isn't practical.</p>
  
  <p><strong>Answer is below in many comments thanks to lxt.  Summary is:</strong></p>
  
  <ul>
  <li>Various libraries and programs associated with libimobiledevice can solve the problems
  <ul>
  <li>Use <strong>patched</strong> iFuse to mount an application sandbox</li>
  <li>Use idevicesyslog to see the console log</li>
  <li>Use ideviceinstaller to install/uninstall apps</li>
  </ul></li>
  <li>The various libraries and programs associated with libimobiledevice are incredibly difficult if not impossible to compile as is on Linux or Mac, and there is no unified distribution of the source or binaries
  <ul>
  <li>For Ubuntu try libimobiledevice (may have 3 suffix), ideviceinstaller and libimobiledevice-utils packages</li>
  <li>For Mac a search for libimobiledevice-macosx may get you some of the way there</li>
  </ul></li>
  </ul>