DEV Community

Cover image for twurl on an iPad? Yes, I can!
Andy Piper
Andy Piper

Posted on

twurl on an iPad? Yes, I can!

I recently got to playing around with a nice iOS app - iSH. iSH essentially enables a minimal Linux-like (ish!) command prompt to run as an app on iOS. It is based on Alpine Linux which is itself based on busybox.

So, as I got to playing with iSH, I thought to myself... what could I do with something like this?

I've been on a bit of a personal crusade / research effort to see how close to a useful development environment I can get to on an iPad Pro, and aside from apps like Pythonista and Pyto (see - a comparison of Python for iOS), iCurlHTTP, Working Copy, and a few others - mostly SSH clients that let me connect to a another system where I can do the actual work - I've found it use-able, but rarely, fully use-ful.

One of my daily work tasks is testing Twitter API responses, and to do that, I typically use twurl. I've written about it before, it's a hugely useful tool, but it was originally written as - and remains - a Ruby Gem, so that can be an overhead sometimes, in terms of where I can use it.

It turns out, following the instructions on the iSH Wiki on GitHub, I was able to get twurl working - but I did discover something interesting along the way.

The minimal instructions are as follows:

apk add jq

# install Ruby (NB ruby-json req'd for some gems)
apk add ruby ruby-dev build-base ruby-json

gem install twurl

twurl authorize

twurl -j "/1.1/users/show.json?screen_name=andypiper" | jq
Enter fullscreen mode Exit fullscreen mode

The interesting discovery here came as the step I've noted above. It turns out that Alpine packages the JSON Ruby stuff in a separate package, which meant that for the first few attempts and this, I was getting an error on executing twurl (ruby 'require': cannot load such file -- json (LoadError)), until I figured this out. I've now updated the iSH wiki with this tidbit.

This should make my mobile life / times away from my laptop, a little easier!

Discussion (0)