Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id

Hello,

I am on Macbook Pro 10.9.4. Using iPad with version 7.1.2 and also iPhone 7.0.4. I have the following capabilities:

capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “iOS”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “iPad”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “7.1”);
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, “Safari”);
driver = new AppiumDriver(“http://127.0.0.1:4723/wd/hub”, capabilities);

Also, i have

  • installed appium via npm
  • made “sudo authorize_ios”
  • cloned https://github.com/snevesbarros/SafariLauncher
  • installed ios-webkit-debug-proxy with brew
  • cloned libplist 1.10, libusbmuxd 1.0.8, libimobiledevice 1.1.5
  • created App ID, provisioning profile, etc.
  • cloned appium from git
  • executed ./reset.sh
  • ran ios_webkit_debug_proxy on port 27753.

When running

node lib/server/main.js -U 4746a925a2456325f9c0aee42c744522ca18f632
I receive the following error:

error: Failed to start an Appium session, err was: Error: Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id [4746a925a2456325f9c0aee42c744522ca18f632]. Error [Error: Command failed: ]
info: [debug] Error: Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id [4746a925a2456325f9c0aee42c744522ca18f632]. Error [Error: Command failed: ]
at /Users/i053650/work/appium/lib/devices/common.js:147:10
at ChildProcess.exithandler (child_process.js:652:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id [4746a925a2456325f9c0aee42c744522ca18f632]. Error [Error: Command failed: ])”,“origValue”:“Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id [4746a925a2456325f9c0aee42c744522ca18f632]. Error [Error: Command failed: ]”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 6638.564 ms - 414

There are lots of strange things in the log like:
info: [debug] Not checking whether simulator is available since we’re on a real device
info: [debug] Trying to use mobile safari, version 7.1
info: [debug] Looking for built in app MobileSafari
info: [debug] Couldn’t find original app, but found the temp Appium one so using that
info: [debug] Using mobile safari app at /tmp/Appium-MobileSafari-7.1.app

info: [debug] Final device string is: ‘iPad (7.1 Simulator)’

If you need further details, I will provide them. Any help will be appreciated! I am straggling with this more than a week and tried everything.

P.S. When installing the MobileSafari using fruitstrap the result is the following:


[ 52%] CreatingStagingDirectory
[ 57%] ExtractingPackage
[ 60%] InspectingPackage
[ 60%] TakingInstallLock
[ 65%] PreflightingApplication
AMDeviceInstallApplication failed: -402653130

Hello,

Even is I build the SafariLauncher using:

xcodebuild -sdk iphoneos8.1 -target SafariLauncher

and deploy it via Xcode devices view, I get the following error:

====================================
info: [debug] Checking app install status using: /Users/i053650/work/appium/build/fruitstrap/fruitstrap isInstalled --id 4746a925a2456325f9c0aee42c744522ca18f632 --bundle com.bytearc.SafariLauncher
info: [debug] Starting command proxy.
info: [debug] Instruments socket server started at /tmp/instruments_sock
info: [debug] Starting instruments
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: Launching instruments
info: [debug] Attempting to run app on real device with UDID 4746a925a2456325f9c0aee42c744522ca18f632
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w 4746a925a2456325f9c0aee42c744522ca18f632 com.apple.mobilesafari -e UIASCRIPT “/Users/i053650/Library/Application Support/appium/bootstrap/bootstrap-aab6b231a30510b7.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {“global”:90000}
info: [debug] [INST STDERR] 2014-10-22 18:15:45.620 instruments[78521:1307] WebKit Threading Violation - initial use of WebKit from a secondary thread.
info: [debug] [INST STDERR] Instruments Usage Error : Specified target process is invalid: com.apple.mobilesafari
instruments, version 6.1 (56160)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument …]]]
info: [debug] [INSTSERVER] Instruments exited with code 255
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #1

Can you please please help?

Let’s try to eliminate some potential issue by trying some smaller cases. Do each of the following work?:

  • run a regular appium test on a local simulator. So get one of the apps we use for testing (in the assets directory. if it is not there try running ./reset.sh --dev)
  • run a Safari test on a simulator
  • now try running a test app on your real device
  • lastly: try the Safari test on a real device.

Hopefully this will help us pinpoint your issue!

Hello Jonahss,

I have done the following:

  • from appium directory run “node lib/server/main.js”
  • in the java code I have defined these capabilities:

case IPHONE:
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “iOS”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “iPhone Simulator”);
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, “Safari”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “7.1”);
driver = new AppiumDriver(http://10.55.56.147:4723/wd/hub, capabilities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
break;

The result is that the iOS Simulator “iPhone 5s / iOS 7.1 (11D167)” is automatically started by the appium and the tests are running successfully (as a matter of fact I am using the “mobile web apps” approach in Appium where I am trying just to load the Safari browser, load my URL and run my selenium tests). So, everything is perfect on the Simulator. If you need, you can check the log file.iOS_Simulator_Appium_logs.log (86.6 KB)

But why isn’t it working on my real devices? I am executing the following for real device:

case IPHONE:
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “iOS”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “iPhone”);
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, “Safari”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “7.1”);
driver = new AppiumDriver(http://127.0.0.1:4723/wd/hub, capabilities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
break;

I have a provisioning profile and I am running:
./reset.sh --ios --real-safari --code-sign ‘iPhone Developer: Eli (ZXB77NZT9X)’

I am running
node lib/server/main.js -U 4746a925a2456325f9c0aee42c744522ca18f632

and I have started
ios_webkit_debug_proxy -c 4746a925a2456325f9c0aee42c744522ca18f632:27753

Could you please help me? Please…

Hi,

I am following appium github issue https://github.com/appium/appium/issues/3876

Thank you very much!

Please help me with the same issue. (need urgent help…!)
I am facing the same issue (error: Failed to start an Appium session, err was: Error: Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id xxxxxxxxxx…).
Although I can run safari test on Simulator(iPhone Ratena (4-inch…))/iPad Ratena with no issues. But could not run my web test on iPhone5c safari.
I have following configuration
Mac=10.9.5
Xcode= 5.1.1
Appium.app= 1.3.1 (running from app - not using node.js)
ios_webkit_debug_proxy running on port 9221
I have downloaded (from -> https://github.com/budhash/SafariLauncher) and installed SafariLauncher with profile provisioning into my device and can be launched in the device(iPhone5c) using following capabilities

appFile=new File("/Users/UC181137/Library/Developer/Xcode/DerivedData/SafariLauncher-deaxcokkxvnqjpbrrfdhpwsekfec/Build/Products/Debug-iphoneos/SafariLauncher.app");
cap.setCapability(“udid”,“xxxxxxxxxxxxxxxxxxxxxxxxxxxxx”);
cap.setCapability(“deviceName”,deviceName);
cap.setCapability(“platformName”,“iOS”);
cap.setCapability(“platformVersion”,“7.1”);
cap.setCapability(“app”, appFile.getAbsolutePath());

But when I try to launch “Safari” browser with following capabilities in iPhone5c it gives error => Error: Unable to install [/tmp/Appium-MobileSafari-7.1.app] .

appFile=new File("/Users/UC181137/Library/Developer/Xcode/DerivedData/SafariLauncher-deaxcokkxvnqjpbrrfdhpwsekfec/Build/Products/Debug-iphoneos/SafariLauncher.app");
cap.setCapability(“udid”,“xxxxxxxxxxxxxxxxxxxxxxxxxxxxx”);
cap.setCapability(“deviceName”,deviceName);
cap.setCapability(“platformName”,“iOS”);
cap.setCapability(“platformVersion”,“7.1”);
cap.setCapability(“app”, appFile.getAbsolutePath());
cap.setCapability(“browserName”,“Safari”);
-------------------------Error Log in Appium Server-------------------
info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.1”,“revision”:“1160ce02bb89c354cb99317985123acf39f0e7d3”}}}
info: <-- GET /wd/hub/status 200 0.539 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.1”,“revision”:“1160ce02bb89c354cb99317985123acf39f0e7d3”}}}

info: --> POST /wd/hub/session {“desiredCapabilities”:{“platformVersion”:“7.1”,“app”:"/Users/UC181137/Library/Developer/Xcode/DerivedData/SafariLauncher-deaxcokkxvnqjpbrrfdhpwsekfec/Build/Products/Debug-iphoneos/SafariLauncher.app",“deviceName”:“iPhone”,“platformName”:“iOS”,“browserName”:“Safari”,“udid”:“78df2266cdb3b158a7d9f470cd6b5e1202f200ed”}}

info: Client User-Agent string: Apache-HttpClient/4.3.3 (java 1.5)

info: [debug] Configuring Safari session
info: [debug] Using local .zip from desired caps: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip
info: [debug] Copying local zip to tmp dir
info: [debug] /Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip copied to /var/folders/dm/dk3xg10d65s1s656w1nm886m0000gp/T/114926-77976-1ecqe90/appium-app.zip

info: [debug] Unzipping /var/folders/dm/dk3xg10d65s1s656w1nm886m0000gp/T/114926-77976-1ecqe90/appium-app.zip

info: [debug] Testing zip archive: /var/folders/dm/dk3xg10d65s1s656w1nm886m0000gp/T/114926-77976-1ecqe90/appium-app.zip

info: [debug] Zip archive tested clean

info: [debug] Unzip successful

info: [debug] Using locally extracted app: /var/folders/dm/dk3xg10d65s1s656w1nm886m0000gp/T/114926-77976-1ecqe90/submodules/SafariLauncher/build/Release-iphoneos/SafariLauncher.app

info: [debug] Creating new appium session e8295d3c-939b-40ad-893d-fdb6772372a8
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder
info: [debug] Setting Xcode version

info: [debug] Setting iOS SDK Version

info: [debug] Getting sdk version from xcrun with a timeout

info: [debug] iOS SDK Version set to 7.1

info: [debug] Not checking whether simulator is available since we’re on a real device
info: [debug] Trying to use mobile safari, version 7.1
info: [debug] Looking for built in app MobileSafari

parseFileSync() is deprecated. Use parseStringSync() instead.

info: [debug] App is not at /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/Applications/MobileSafari.app
info: [debug] Couldn’t find original app, but found the temp Appium one so using that
info: [debug] Using mobile safari app at /tmp/Appium-MobileSafari-7.1.app
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Could not parse plist file (as binary) at /tmp/Appium-MobileSafari-7.1.app/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML
info: [debug] Could not parse plist file (as XML) at /tmp/Appium-MobileSafari-7.1.app/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings; assuming it doesn’t exist
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Creating instruments
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/UC181137/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {“nodePath”:"/Applications/Appium.app/Contents/Resources/node/bin/node",“commandProxyClientPath”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false}
info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

info: [debug] Dynamic bootstrap path: /Users/UC181137/Library/Application Support/appium/bootstrap/bootstrap-60f23230385b0cfa.js
info: [debug] Reusing dynamic bootstrap: /Users/UC181137/Library/Application Support/appium/bootstrap/bootstrap-60f23230385b0cfa.js
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“5.1.1”,“iOSSDKVersion”:“7.1”,“deviceName”:“iPhone”,“platformVersion”:“7.1”}
info: [debug] fixDevice is on
info: [debug] Fixing device. Changed from: “iPhone - Simulator - iOS 7.1” to: “iPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1”
info: [debug] Final device string is: ‘iPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1’
info: [debug] Not setting device type since we’re on a real device
info: [debug] Checking whether we need to set app preferences
info: [debug] Not setting iOS and app preferences since we’re on a real device
info: [debug] Reset not set, not ending sim or cleaning up app state
info: [debug] Not setting locale because we’re using a real device
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS device log capture via deviceconsole

info: [debug] Not pre-launching simulator

info: [debug] Checking app install status using: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id 78df2266cdb3b158a7d9f470cd6b5e1202f200ed --bundle com.bytearc.SafariLauncher

info: [debug] Installing app using cmd: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/fruitstrap/fruitstrap install --id 78df2266cdb3b158a7d9f470cd6b5e1202f200ed --bundle “/tmp/Appium-MobileSafari-7.1.app”

info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone mobile_installation_proxy[127] : LaunchServices: Please include the kCFBundleIdentifierKey in the options dictionary when installing an app.

info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone mobile_installation_proxy[127] : LaunchServices: installing app for existing placeholder (null)

info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone installd[63] : 0x297000 handle_install_for_ls: Install of “/var/mobile/Media/PublicStaging/Appium-MobileSafari-7.1.app” requested by mobile_installation_proxy

info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone installd[63] : 0x297000 MobileInstallationInstall_Server: Installing app com.apple.mobilesafari

info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone installd[63] : 0x297000 check_can_install: Cannot upgrade system/internal application com.apple.mobilesafari because it does not have the required entitlement.

error: Failed to start an Appium session, err was: Error: Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id [78df2266cdb3b158a7d9f470cd6b5e1202f200ed]. Error [Error: Command failed: ]

info: [debug] Cleaning up appium session
info: [debug] Error: Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id [78df2266cdb3b158a7d9f470cd6b5e1202f200ed]. Error [Error: Command failed: ]
at /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/common.js:147:10
at ChildProcess.exithandler (child_process.js:652:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Socket. (child_process.js:969:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id [78df2266cdb3b158a7d9f470cd6b5e1202f200ed]. Error [Error: Command failed: ])”,“origValue”:“Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id [78df2266cdb3b158a7d9f470cd6b5e1202f200ed]. Error [Error: Command failed: ]”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 4431.057 ms - 414
info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone installd[63] : 0x297000 install_application: Could not preflight application install
info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone mobile_installation_proxy[127] : 0x305000 MobileInstallationInstallForLaunchServices: failed with -1
info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone mobile_installation_proxy[127] : ERROR: MobileInstallationInstallForLaunchServices returned nil
info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone mobile_installation_proxy[127] : 0x305000 handle_install: Installation failed: Error Domain=LaunchServicesError Code=0 “The operation couldn’t be completed. (LaunchServicesError error 0.)” UserInfo=0x1462adf0 {Error=ApplicationAlreadyInstalled}

info: [IOS_SYSLOG_ROW ] Oct 26 08:43:53 TRiPhone installd[63] : 0x297000 handle_install_for_ls: API failed

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.1”,“revision”:“1160ce02bb89c354cb99317985123acf39f0e7d3”}}}

info: <-- GET /wd/hub/status 200 1.758 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.1”,“revision”:“1160ce02bb89c354cb99317985123acf39f0e7d3”}}}

-------------------------End of Log-------------------------------------

Does somebody know how to resolve such entitlements problem as above?
Should be smth specific configured in provisioning file?

I got the same one:

info: [IOS_SYSLOG_ROW ] Oct 27 16:52:50 iPhone-artemgr installd[63] : 0x303000 MobileInstallationInstall_Server: Installing app com.apple.mobilesafari
info: [IOS_SYSLOG_ROW ] Oct 27 16:52:50 iPhone-artemgr installd[63] : 0x303000 check_can_install: Cannot upgrade system/internal application com.apple.mobilesafari because it does not have the required entitlement.
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Unable to install [/tmp/Appium-MobileSafari-7.1.app] to device with id [f5a12bb78ace2c11f6f5f393f7ec253aaadf42df]. Error [Error: Command failed: ]

The only solution that worked for me was to use appium version 1.2.4. For the latest version, I guess we are waiting for a fix…

1 Like

hello emilanova,
could you please share your steps like as follows. It would be great.
1-Configuration
a) Mac = ?
b) iOS = ?
c) Appium = 1.2.4
2- Steps to start appium
a) $ ios_webkit_debug_proxy -c :22752-22758
b) appium => $ ?
c) SafariLauncher installation => ?
etc.
I’ll be really grateful to you if you could share your steps in detail.
Best Regards,
Syed

I reverted to Appium v 1.2.4 but still has the same issue :-(.

-Amarnath Rayudu

With 1.2.4 it really works, thanks!

Syed1, Amarnath Rayudu
I was very safe because spent a lot of time before. So I got exact device with iOS 7.1 corresponding to XCode installed 5.1 - may it helps

Sorry for the late reply MaxSki, I fixed it and forgot to update it here.

Thanks,
Amarnath Rayudu