IOS – Run a standard unix process (not an app) on iPhone from OS X command line

iosiphonexcode

I'm working on improving iOS cross-compilation support for ghc, which has a metaprogramming feature which requires running code at compile time. One mechanism for this involves running a process on the target and communicating with it from the compiler via pipes. This is a standard unix process (one compiled for iOS), not an iPhone app. How can I launch this process on a connected iPhone from the OS X box where the compiler is running? For the simulator I can use simctl spawn but I don't know of anything similar for real devices.

Best Answer

You can't.

Jailed iOS devices have no method of executing any given program remotely. You'd have to jailbreak your device to be given access to terminal.

The iOS simulator is slightly different since it lacks many of the security features that the full iOS has, and since its running directly on your mac as child processes (rather than an emulator emulating a ARM processor).