2

This is not for a production application - I'm just tinkering for the fun of it (on a device, not the simulator).

Is there any mechanism for executing arbitrary binaries on iOS? Say, ls.

I've tried posix_spawn(), but it always returns a status of 1.

system() doesn't even compile, it fails with: 'system' is unavailable: not available on iOS

fork() is similarly not allowed

I realize it's a long-shot, but I have a couple (local/personal) projects that are written as pre-compiled ARM binaries and I'd love to have them available on my iPad. (Plus it's just a fun experiment.)

Sidenote: I haven't jailbroken an iOS device in years and I'm hoping to avoid it - if the above isn't possible with stock iOS, I'll just sigh and move on.

2
  • 2
    Sandboxed apps on a non-jailbroken device can't kick off other processes. Commented Apr 26, 2019 at 15:26
  • Thanks @rmaddy, that's the conclusion I'm finding from pretty much every resource I read. I suppose I was holding out hope that there was some workaround/low-level API that is usable on devices, but would understandably fail the App Store review. Sounds like we'll just have to wait for "developer mode" :-) Commented Apr 26, 2019 at 15:42

1 Answer 1

2
+300

There's a project called Linux shell for iOS on GitHub to get a Linux shell running on iOS, using usermode x86 emulation and syscall translation.

You'll need these things to build the project:

  • Python 3
  • Ninja
  • Yarn (only when building for iOS)
  • Meson (pip install meson)
  • Clang and LLD (on mac, brew install llvm, on linux, sudo apt install clang lld or sudo pacman -S clang lld or whatever)
  • sqlite3 (this is so common it may already be installed on linux and is definitely already installed on mac. if not, do something like sudo apt install libsqlite3-dev)

I found this GitHub link in this post.

P.S. I'm glad it's running.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

This is 100% wizardry. It definitely takes some knowledge of Xcode to get the project building and launching, but it took me < 20 minutes to get this going on my iPad Pro: imgur.com/a/O8SO99u Yes, that's a Python web server running on the device itself. I can't believe this project didn't turn up in my searching. Things like make and gcc work as well. The only thing that hasn't worked in my limited testing so far is java, but there's an open issue for that: github.com/tbodt/ish/issues/306

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.