This short guide will imply jailbreaking the iPad, using the command line (I will need a full-fledged computer to make it) and some SSH fiddling. If this makes anyone uncomfortable then please leave.
I wrote the guide for me as a memento long ago and that implies I’ve got some experience in *NIX systems and am willing to make some Googling to find creative solutions. Be advised.
Current iOS version at the time of this writing is
7.0.4 and I’ve applied this guide with success to an iPad Air and a first version iPad Mini (the non-retina version).
I’ve got the iPad almost always with me and since I enjoy coding I’d like to be able to do so efficiently anywhere. Using Test-driven development techniques to do so I do not want to just write code but to be able to test it too. On the same machine I write it possibly.
The end result
The result of this short guide is being able to edit code using vim text editor or any other code IDE for iPad, pull and push modifications to the code using command line git and, optionally, running PHPUnit tests via the command line (I’m a PHP developer).
It’s not that the iPad lacks good code editors but they all lack, due to Apple sandboxing limitations, the power to interoperate efficiently one with the other; when I say “efficiently” I mean I can do it using an external keyboard at about the same speed I can work on my MacBook Pro.
Jailbreaking and requirements
First step into this adventure is jailbreaking the iPad itself. I’ve used evasi0n tool to do so and that’s as easy as pushing a button. Litterally.
As easy as supporting the project.
Once the jailbreaking is done a new Cydia app icon will appear on the springboard. I’m not delving into details here but I’ve installed the OpenSSH package to be able to remotely login into the iPad.
De-sandboxing applications via SSH
To actually work on the iPad I will use
vim code editor and to use
vim I will need to be able to access the terminal. I will use Prompt app by Panic to log into the local host address
127.0.0.1; trying this now would result in an error that’s simply the app “hitting the walls of its sandbox container”: I have to give the app root privileges moving it to the same place other Apple (read “system”) applications reside.
I will find the location of the
cd /var/mobile/Applications find . -name Prompt.app
to get the name of the folder, a long alpha-numeric string, the app has been installed into and then move the app “executable” among the non-sandboxed applications
cd E86861F7-1DC0-40BF-82BD-28FF9491422B/ <<< insert the folder found with the find command mv Prompt.app/ /Applications
I will now open the iPad and delete the Prompt.app icon as if to uninstall it. After that, getting back to the SSH shell and refresh the springboard as the
su mobile uicache
After that the Prompt app icon will be back on the springboard and will now be able to connect to the
The same principle really applies to any app.
Install aptitude package manager (optional)
I will install
aptitude via Cydia to be able to download packages via the command line. Any package I install via the command line, either via an SSH session or the Prompt app, can be installed using Cydia UI.
Install vim and git
Using SSH I will type the command
su - <<< to get back to the root user, will request password aptitude install vim git wget curl coreutils coreutils-bin
and that’s all.
Create SSH keys to be able to use GitHub
Distributed version control is a must for me and almost any one using a computer for anything beyond social networks will need to use git and/or GitHub. Sadly that can’t be done out of the box when it comes to pulling and pushing from/to GitHub repositories due to missing SSL certificates.
As detailed on GitHub help page I will generate a private and public keys using SSH
ssh-keygen -t rsa -C "email@example.com"
and answer to the generator response for a key location, I will use the default one, and a passphrase. Following along GitHub guidelines I will print the public key contents to screen to be able to copy and paste them to GitHub (this I will do via SSH and a real PC)
and will follow the guide from that point.
Please note that this set up will allow for repository cloning via SSH and not the “usual” way.
I will usually install PHPUnit using pear but since I’m working in a reduced enviroment here I will just download
phpunit.phar file and move it to the executables directory
wget --no-check-certificate https://phar.phpunit.de/phpunit.phar chmod +x phpunit.phar mv phpunit.phar /usr/local/bin/phpunit
from the command line will yield PHPUnit version information.
Expand and extend
Now that I’ve got the tools and know-how I can extend the iPad possibilities and common pitfalls. No need to wait for an iPad Pro when a current jailbroken iPad will give me almost 10 hours of portable and local programming environment.
But I hate vim!
No, I love it but I believe anyone has the right to choose its tools and
vim is not an option when there isn’t a keyboard connected to the iPad; I’m not that masochist.
In those cases I will use another iPad coding IDE app and after I’ve created a symbolic link to its
Documents folder in the
root user home folder (
/var/root); I’m doing this for Textastic here
find /var/mobile/Applications -name Textastic.app
after the folder containing Textastic has been found
ln -s /var/mobile/Applications/5831B796-F4AF-4F9C-8F4A-A5A7B49750CE/Documents/ /var/root/Documents
and now editing any file in the
/var/root/Documents folder will show into Textastic.
I will pull and push
git repositories in the
/var/root/Documents folder and those will magically appear in Textastic documents.