22

I'm using xcodebuild install -alltargets -iphoneos4.2 -activeconfiguration provisioning_profile=path_of_my_provisioningprofile code_sign_identity=identity. This command is building my app and i am getting build file (.app) also. But how to install the app in to device from command line. Please help me in this issue.

7 Answers 7

20

Fruitstrap is no longer maintained, for a more up to date project checkout the fork by PhoneGap called ios-deploy.

To install run: npm install -g ios-deploy

Here are some examples of how to use it:

// deploy and debug your app to a connected device
ios-deploy --debug --bundle my.app

// deploy and launch your app to a connected device, but quit the debugger after
ios-deploy --justlaunch --debug --bundle my.app

// deploy and launch your app to a connected device, quit when app crashes or exits
ios-deploy --noninteractive --debug --bundle my.app

// Upload a file to your app's Documents folder
ios-deploy --bundle_id 'bundle.id' --upload test.txt --to Documents/test.txt
4
  • thanks! I got a working setup using iOS 9.3.1 and OS X 10.11.3 Commented May 1, 2016 at 21:42
  • 3
    A modern, working answer in an often obsolete world. Cheers!
    – mix3d
    Commented Jun 2, 2016 at 16:18
  • I don't believe it. It works. Out of the box. No setting required. AMAZING.
    – Roy Falk
    Commented Jul 6, 2017 at 10:54
  • The install worked nicely but not the debugging: error: python failed attempting to evaluate 'fruitstrap_device_app="/private/var/containers/Bundle/Application/... Commented Oct 19, 2018 at 0:33
6

Fruitstrap: https://github.com/ghughes/fruitstrap

Here's a good tutorial to set it up: http://sgleadow.github.com/blog/2011/11/05/installing-ios-apps-on-the-device-from-the-command-line/

5

Looking around found https://github.com/benvium/libimobiledevice-macosx. This is a port from libimobiledevice to MAC-OS X. Its very useful and no jailbroken is needed. :P

0
4

Use this beautiful script : http://gamua.com/blog/2012/03/how-to-deploy-ios-apps-to-the-iphone-via-the-command-line/ - Then connect iphone device via usb to mac running this command

To launch app on command line:

instruments -w 4xxxxxxxx9 -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate NITC -e UIASCRIPT Launch-App.js

format : instruments -w <deviceid> -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate <applicationname> -e UIASCRIPT Launch-App.js

My Launch-App.js has only one line - var target = UIATarget.localTarget();

This must be sufficient to launch application on device using command line

5
  • 2
    Whoa, I've never seen instruments mentioned when pushing an App or IPA to a device - +1. Is there a way to have instruments list the device ID's used with -w?
    – jww
    Commented Oct 19, 2013 at 10:17
  • @noloader +1 for how to list devices IDs, I'd love to know.
    – Adam Sharp
    Commented Mar 16, 2014 at 23:13
  • 1
    Fruitstrap (what the link uses) is now abandoned and does not work with iOS 7 :(
    – Jess
    Commented Jul 29, 2014 at 19:18
  • 2
    In case anyone comes across this and is still wondering about the device IDs: instruments -s devices
    – JBarberU
    Commented Mar 23, 2015 at 15:31
  • This isn't working with Xcode 9.1—I don't appear to have AutomationInstrument.bundle.
    – SilverWolf
    Commented Nov 28, 2017 at 21:34
2

What about this:

how to intall an ipa/app file into iPhone with command line?

Third solution with libimobiledevice.

1

ipatool: https://github.com/majd/ipatool

Step 1: Search the app bundle id

 ./ipatool search testflight --limit 1

> ==> ℹ️    [Info] Searching for 'testflight' using the 'US' store front...
> ==> ℹ️    [Info] Found 1 result:
> 1. TestFlight: com.apple.TestFlight (3.1.0).

Step 2: Download the IPA

./ipatool download --bundle-identifier com.apple.TestFlight 

Easy!

1

Install following packages on MAC

brew install libimobiledevice  
brew install ideviceinstaller 

After successfully installed above packages.

Use following command to install .ipa file on iOS devices:

ideviceinstaller -i <Path_to_your_ipa>

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.