A-Shell: Terminal for iOS
holzschu.github.io
holzschu.github.io
Is there any documentation on what shell syntax this supports? I assume it's not running a standard shell like Bash or zsh.
Edit: https://github.com/holzschu/ios_system/blob/master/README.md confirms its not running sh, bash, or zsh, and has some additional details on the available commands. I still think it would be nice for this to be more explicit, but the information is out there.
iSH uses a completely different approach -- it's a custom x86+linux emulator that runs complete unaltered alpine linux userland: https://ish.app/
I assume one is a fork of the other?
A-Shell seems to be very limited and additional packages cannot be installed. What are uses cases for which A-Shell would be a better fit than iSH?
A-Shell is basically a fully functional "vim in iOS" and serves as my default iOS text editor.
On Android, I love using Termux (https://termux.com/).
If I have a computer in my pocket, I should be able to use it as a computer, not merely a consumption device
Working Copy is an excellent GIT client and works well with many of the above and there are plenty of coding editors. There are also a plethora of non-programming creativity apps, many of which are useful for coding projects.
Bummer there’s no git¹.
I was curious to try to install Go just to see how far I’d get before being blocked. Was able to download the source tarball and extract it (using curl and tar as 2 separate commands; piping curl into tar didn’t work). But then can’t execute make.bash because there’s no bash.
[1] There's rationale and an alternative described at https://github.com/holzschu/ios_system#adding-more-commands.
/private/var/mobile/Containers/Data/Application/49F47295-F9D8-4FD7-8F34-redactedxxxx/
The default folder is /private/var/mobile/Containers/Data/Application/49F47295-F9D8-4FD7-8F34-redactedxxxx/Documents
I am able to cd / and can see the following folders
/Applications
/bin
/cores
/dev
/Developer
/etc
/Library
/private
/sbin
/System
/tmp
/usr
/var
... but can't cd into any of them. "permission denied".
None of this is a surprise, of course.
`python --version` returns 3.7.1.
`curl --version` returns 7.54.0.
Issues: In iOS, you cannot write in the ~ directory, only in ~/Documents/, ~/Library/ and ~/tmp. Most Unix programs assume the configuration files are in $HOME. So either you redefine $HOME to ~/Documents/ or you set configuration variables (using setenv) to some other place. This is done in the initializeEnvironment() function.
Here's what I have:
setenv PATH = $PATH:~/Library/bin:~/Documents/bin setenv PYTHONHOME = $HOME/Library/ setenv SSH_HOME = $HOME/Documents/ setenv CURL_HOME = $HOME/Documents/ setenv HGRCPATH = $HOME/Documents/.hgrc/ setenv SSL_CERT_FILE = $HOME/Documents/cacert.pem
Your Mileage May Vary. Note that iOS already defines $HOME and $PATH.
To my knowledge, the reason no “real” terminal exists for iOS is because it violates the App Store rules. It is prohibited to download and execute arbitrary code, with a few exceptions.
One exception is JavaScript, which must be run inside of JavaScript Core [1]. What if someone simulated x86 and Linux _in JavaScript_ and then built a terminal and file system on top of it? Would that be in accordance with the App Store rules (since it would be sandboxed in Apple’s JS core)? Would it even be technically feasible? Or too slow for any serious usage?
[1] from the App Store rules:
4.7 HTML5 Games, Bots, etc. Apps may contain or run code that is not embedded in the binary (e.g. HTML5-based games, bots, etc.), as long as code distribution isn’t the main purpose of the app, the code is not offered in a store or store-like interface, and provided that the software (1) is free or purchased using in-app purchase; (2) only uses capabilities available in a standard WebKit view (e.g. it must open and run natively in Safari without modifications or additional software); your app must use WebKit and JavaScript Core to run third-party software and should not attempt to extend or expose native platform APIs to third-party software; (3) is offered by developers that have joined the Apple Developer Program and signed the Apple Developer Program License Agreement; (4) does not provide access to real money gaming, lotteries, or charitable donations; (5) adheres to the terms of these App Review Guidelines (e.g. does not include objectionable content); and (6) does not offer digital goods or services for sale. Upon request, you must provide an index of software and metadata available in your app. It must include Apple Developer Program Team IDs for the providers of the software along with a URL which App Review can use to confirm that the software complies with the requirements above.
Educational apps are an interesting exception, but as I quoted in my patent comment, JavaScript is the other major one.
So I wonder if JIT compilation and execution is possible under the rules in JavaScript? (Again, is that even feasible?)
So, these are the technical limitations of the platform. Apple chose to implement a number of arbitrary rules on top of that. Well, it's not a democracy, and they are free to do so. There is always a slight chance of having some form of less restricted execution environment in future versions of iOS, mainly due to how much their iPad Pro hardware is overpowered relative to the OS capabilities.
I wonder if that process can be automated to a point where you could “lib-ize” any C/C++ project (sed replacing malloc/free with something that cleans up when the process “exits”, replacing exit/fork/etc, replacing static). I think that would really open up the number of interpreters available on iOS.
I'm actually surprised it's only about 650 MB. TeX (Live) alone is huge.
> clang/clang++ compiles your C/C++ files to webAssembly with wasi included. Executee the resulting files using 'wasm command'. You can also compile to webAssembly elsewhere and bring the files to your iPad.
> LLVM: You can compile C code into LLVM IR format with clang and interpret it with the lli command.
Sadly, it seems Apple doesn't really care about this.
Android 10 is locking down http://termux.com, and wifi ipads have higher compute/$. If this works at full speed, I might get one.
---
On June 5th of this year [2017], the Apple Developer Program License Agreement (which applies to both the iOS and Mac App Stores) was revised to:
3.3.2 ..Interpreted code may be downloaded to an Application but only so long as such code:
(a) does not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store,
(b) does not create a store or storefront for other code or applications, and
(c) does not bypass signing, sandbox, or other security features of the OS.
---
An Application that is a programming environment intended for use in learning how to program may download and run executable code so long as the following requirements are met:
(i) no more than 80 percent of the Application’s viewing area or screen may be taken over with executable code, except as otherwise permitted in the Documentation,
(ii) the Application must present a reasonably conspicuous indicator to the user within the Application to indicate that the user is in a programming environment,
(iii) the Application must not create a store or storefront for other code or applications, and
(iv) the source code provided by the Application must be completely viewable and editable by the user (e.g., no pre-compiled libraries or frameworks may be included with the code downloaded).
That's extreme overkill for my needs -- I'd just like the ability to log in to a few hosts (preferably using public key authentication!) and run various commands just like I normally do in a terminal.
If anyone has any "favorites" they recommend, I'd be interested in hearing about them. I'd prefer something open-source (out of principle) but I'm certainly not opposed to paying a reasonable amount.
But this is one of the apps I cannot believe is not subscription-based. Author keeps up with changes in iOS and improves constantly.
The cost is justified too as the market for terminal emulators is much smaller than general iOS audience.
I don't do any professional development on my iPad, I just like having the ability to mosh/ssh back into my machines at home to run a script or push a quick edit to my personal github.
This connects, in shell mode, to your iOS device.
I have a copy of both Blink and Prompt. Normally I use Blink more, but this keep alive is a really handy feature.
Thanks!!
And
> "A text-based user interface for a screen-based platform"
Is that a play on "Limitless paper in paperless world" from a Dunder-Mifflin ad?[0]
e.g. yesterday on HN: https://news.ycombinator.com/item?id=22968079
Seems like there's pent up demand for more hacker stuff on mobile! :) I wonder what this could mean for the direction of the mobile paradigm (move towards fewer walled gardens like app stores please?)
What I love about Blink is that it supports mosh and it includes tunnels, ssh-agent etc. out of the box (no need to install anything). It seems very well polished for the purpose of remote work. I have a mosh session open with our deep learning server in the lab 24h (works with network outage etc.).
I assume you can setup the same on A-Shell. Will play with it and update here.
Edit: spelling error
Registering for an account is free. you can get a signing key for testing (i.e. to build and run on your own device) for free also. You only need to pay if you want to publish to the App Store.
What iOS really needs to make this useful though is a way to project to a proper screen and keyboard/mouse configuration. Like Samsung DeX. Kinda hoping this will happen as they are making the iPad Pros more like a computer.
iSH is threading, that is, the x86 code is translated into an IR consisting of pointers to the code that executes its interpretation. This is a technique older than FORTH and which may be the best you can do on iOS currently. A-Shell may do the same, I don't know.
EDIT: updated with more details.
Love it