6

How do I get the bundle identifiers of all the apps installed on an iOS simulator?

I want to automate uninstallation of a specific app called WebDriverAgent (used by Appium) via a script.

e.g.

xcrun simctl uninstall booted com.example.apple-samplecode.UICatalog
the_prole
  • 8,275
  • 16
  • 78
  • 163
  • I have the same exact need, for the same exact goal Did you manage to find a way? In Xcode AppleScript I manage to get current scheme, but the only thing I can get is its name or its ID (but not Bundle ID…). – AnthoPak Feb 27 '20 at 12:59
  • Don't remember if I did or not, but I think the bundle ID might be in a configuration file that each app has, so maybe use grep or find to get an array of those files, then parse the bundle ID from the file, I think maybe the file was called plist but not sure. – the_prole Feb 28 '20 at 00:41
  • Thanks for the answer. The issue is that in Info.plist, it just references $(PRODUCT_BUNDLE_IDENTIFIER). I ended up using this command https://gist.github.com/shazron/6093283#gistcomment-2360716 instead, and it works well :) – AnthoPak Mar 02 '20 at 15:46

3 Answers3

12
xcrun simctl listapps {DEVICE_UUID}

Will list all of the installed applications on the Simulator

CodeBreaker
  • 301
  • 2
  • 9
3

for simulator

ideviceinstaller -l -o list_all

for real devices

ideviceinstaller -u <UDID> -l -o list_all
El David
  • 616
  • 8
  • 17
1

Apps are installed in this directory: ~/Library/Developer/CoreSimulator/Devices/[DeviceID]/data/Containers/Data/Application/ [DeviceID] being the simulator's UDID you are using. Every time a new app installed a new directory is created.

I bet your WebDriverAgent lies in there and can be removed.

palme
  • 2,499
  • 2
  • 21
  • 38
  • I was able to use `useNewWDA=true` capability – the_prole May 04 '18 at 22:21
  • Nice! Great you figured it out yourself. Maybe you can explain it a bit more in detail for future readers that have the same problem :) – palme May 05 '18 at 06:25
  • Only problem is these ids don't have names, they are just numbers. How to know which app they belong to? – the_prole May 18 '18 at 03:34
  • Are these bundle identifiers? What are they? – the_prole May 18 '18 at 04:08
  • One is the device-id for the device, the other one seems to be a random identifier for your application. It is not the bundle identifier, this most of the time follows this reverse domain structure, e.g. com.the_prole.myapplication – palme May 19 '18 at 05:11
  • Is it possible to find the bundle identifier inside one of these randomly numbered folders? – the_prole May 19 '18 at 20:07
  • You find several things in the application folder: one "hacky" way would be to check the `Preferences` folder for example and check for the plist file which has the bundle identifier as it's name. – palme May 20 '18 at 19:03
  • This is of course depending on your situation. You probably will only find an app in that folder. Getting the bundle ID from that won't be easy even if you look at the app package content. Guess that is really intentional by apple ;) – palme May 20 '18 at 19:23