Getting Perl, CPAN, and Texapp going on iOS 6.x

If you are about to try and do this, you are probably as crazy as I am. Welcome. Here you go.

1. Jailbreak your iOS Device with evasi0n.

You aren’t going anywhere until you get that level of access to the device. This is the slickest rooting tool yet for iOS. Kudos to the evad3rs team.

20130218-084219.jpg

2. After you get cydia live on your “jailbroken” iOS, immediately install Install apt, make, Open SSH, wget, Vim (Vi IMproved)

20130218-084402.jpg

3. Login vi SSH to localhost and change the root password on the iOS device. The previous one is “alpine” and you should give it a new one. Leaving SSH open and not changing your root password is crazy bad. You can install a terminal via Cydia, but the better app is Prompt from Panic. Either way, you need a term. Prompt, in my tests over the years, is the best I have used.

At this point, I would recommend you ssh into your iOS device from a laptop. It will just be easier. Get the IP address of your iOS device and ssh into it as root.

4. Add the perl repo over at coredev.nl to apt and cydia. This repo isn’t part of the standard cydia sources. The easiest way to do this is while via an ssh session. Big thanks to the Thireus Blog on this.

After adding the repo, I didn’t get cydia to include the packages until after I restarted the iPhone. I tried all different types of ways either via killing cydia and starting it again and even issuing an apt-get update, but no dice. So, I am recommending an iPhone restart here to make sure.

5. Eventually and either through a system restart, cydia refresh and/or an apt-get update, you will see perl packages available to you in cydia from coredev.nl. Install them all.

20130218-084549.jpg

6. Start cpan from the ssh terminal in the iOS device. Run setup as needed. It will run through the lot of questions on setup.

7. Once you have a CPAN prompt, issue install Bundle::CPAN to get it up to date. It will take a while.

8. Reload CPAN or exit it and go back in to get all the changes/updates you just played in #7.

9. Install some CPAN modules from a CPAN prompt:

Now you should have the perl foundations and other tools in place. You can get to snagging Texapp and the SSL stuff for cURL.

10. While in an SSH session on the iOS device, do a wget to snag the current texapp release. @doctorlinguist is keeping the location consistent version to version, so this should always retrieve the current.

11. Then make it executable

12. I move it to an executable path, but you can leave it wherever.

13. Texapp has a set path for perl in /usr/bin but the hacked perl on iOS path is /usr/local/bin so you need to edit the /usr/bin/texapp executable with the proper path. iOS doesn’t come with editors, but we did snag vim, so you can run that to edit and save.

vim-texapp

 

14. Texapp will not work yet until you get the cURL SSL stuff setup. This was a pain to deal with. Cameron has a great script to generate the ca cert bundle and you can run it while on the iOS device to retrieve and make what cURL needs. The location of where cURL was looking for it was the pain. I kept putting it in /etc/ssl/certs but that is wrong. Anyway, get the script from Floodgap, make it executable and run it.

20130218-084523.jpg

15. You will get a ca-cert.crt file back from script in the same directory. You need to move that to where cURL is looking for it. You can find that out by issuing the curl command to an https site and seeing the path it expects the ca-certificates.crt file.

20130218-122157.jpg

 

SSL cURL requests are looking for the ca-cert at

So, you need to move the .crt file generated from the mk-ca-bundle script to /etc/ssl/certs/ca-certificates.crt. The file naming is important. Just putting the ca-bundle.crt file in the directory won’t cut it. Issue this

16. Test the cURL connection again to the https site and if you get some data back, SSL cURL is happy and you can proceed with Texapp.

17. At this point, you can start Texapp. I would recommend again to do this from a computer ssh session so you can easily copy/paste the token setup to browser process and back. It can be done inside Prompt or MobileTerminal on iOS, but it can also get extra characters if you do which messes everything up.

18. You can also add your own .texapprc file via vim in the root user directory to save some Texapp preferences. Here is mine.

19. When you do the whole token generation, you are set to go with Texapp on iOS.

20130218-084646.jpg

Texapp running on iOS 6.1

20130218-084627.jpg

 

Leave a comment or reply