The iPad Pro as main computer for programmingdocker golang iPad Pro node.js ruby
In the summer of 2017, I wanted to know what it would be like to use an iPad Pro as my main computer. I found out that it can actually work, thanks to an iOS app called Blink, an SSH replacement called Mosh, iOS 11 and running stuff on a server. You can jump right to the TL;DR.
This piece is written from the perspective of a backend engineer. Visit the internet to see how an editor, a product manager and a web & graphics designer use an iPad as their main computer.
As is tradition, I will first explain myself and tell you about the why.
Anyone who’s used docker for development on OSX knows that while it’s a lot of fun and working fine in general, it also tends to make your laptop so hot that it’s very uncomfortable to work with no pants on:
So I wondered… My laptop is busy enough feeding RAM to Chrome and dedicating all its CPU cycles to displaying ads on webpages with parallax scrolling and videos on auto play. Why even make that poor little thing also run Docker?
Is there another way? Of course there is! Run Docker so far away that it can’t possibly fry my thighs!
But before we dive into the whole iPad as the main computer thing, let’s take a step back.
Being an old person, I pretty much spend most of my programming time in the terminal. I use zsh as a shell (although I’ve been interested in elvish lately), tmux for window management and neovim as an editor. I program mostly in ruby, go and node and run everything using Docker.
Apart from that, I use Inbox and Slack for communication, a web browser for my googling, dash to look up documentation, 1Password to manage my passwords and Alfred to be fast at all of that.
According to the activities report on rescuetime.com, I spend around 60 % of my time writing software and 17% communicating in one way or the other. And I’m lucky - with the exception of Alfred, all of the applications I rely on are available on iOS (more on that further down this page).
In conclusion, I guess you can say that my workflow is suited perfectly for this experiment. I’d be out of luck if I relied on a visual IDE or proprietary software as is the case when you’re, say, an iOS developer.
There were a couple of problems to overcome:
- make my work environment portable (zsh, tmux, neovim and a lot of tooling)
- make a remote session feel as snappy as a local one
- make the remote machine as secure as the local one
First, let’s solve 1): make my work environment portable
Dockerize tmux & neovim
For centuries, people have been syncing their dotfiles between machines in order to make their shells and editors behave the same whether they’re logged in locally or on a server. An easy way to do this is to have them in a private git repository that you keep up to date on every machine. This approach, however, only syncs configuration, though (give and take a bunch of shell and vim scripts).
In my day to day work, I also rely on a lot of tooling that needs to be synced. Off the top of my head, that’s Docker, a bunch of linters, other tools like jq and ag as well as utilities like the Google Cloud Platform SDK. In this case, syncing your dotfiles just won’t cut it.
The solution was easy: just bake all of that into a Docker image. When I type
docker run jannis/shell, this starts a container with:
- tmux 2.5
- neovim 0.2.0
- all my tooling
The cool thing is that with such a docker image it doesn’t matter where I type
docker run jannis/shell, be it on a server or on my laptop. The result is the same: I’ll jump right into a wonderfully configured tmux with neovim, True Color support, italics and everything you I could wish for. Yes, I hear the young people laugh now, with their Sublimes and Atoms that can display italics out of the box. But for me this is an accomplishment, alright?
First problem solved, my work environment is completely portable now. I literally can’t tell if I just launched zsh/tmux/nvim on my laptop or on a server. Well. I kind of can, because when SSH’ing while on a 4G/LTE connection, there’s some noticable latency.
So let’s solve 2): make a remote session feel as snappy as a local one
SSH, but without the lag
There’s a fantastic piece of software called Mosh: the mobile shell:
Remote terminal application that allows roaming, supports intermittent connectivity and provides intelligent local echo and line editing of user keystrokes.
Mosh is a replacement for SSH. It’s more robust and responsive, especially over Wi-Fi, cellular, and long-distance links.
Sounds like just what I was looking for. Not only does it remove the perceived lag, it offers a bunch of other great features that are especially useful for the very mobile use case of using an iPad as your main computer: Sessions stay intact over IP changes and disconnects.
Well that was easy - now off to the final problem 3): make the remote machine as secure as the local one.
Deploying a VPN server is easy
With the server being your main development machine, it makes sense to configure your firewall to drop any incoming connections (remember to keep the ports for SSH/mosh open). What if you’re working on a web app and want to try it with the browser? The firewall won’t let you in anymore!
The solution is easy: just run the hwdsl2/docker-ipsec-vpn-server docker image and you have a VPN server that you can natively connect to with OSX (and iOS). That way you - and only you - can connect to any service on your server.
So, where are we? We have detached the working environment - shell, editor, tooling - from the laptop. Everything can run locally on the laptop, like it always did. Nothing changed here.
But now we have a development environment that runs on a mainframe server, so all we need is a terminal computer to connect to it. As long as it runs Mosh, we’re good.
Now that we have the server side taken care of, let’s see how we can turn the iPad Pro into a proper workstation. Here’s my work home screen:
The essential app here is the wonderful Blink (or if you’re on mobile: App Store Link), fifth from the left in the Dock. It’s a terminal app for iOS that supports SSH and mosh, and while it’s open source and can be obtained for free, I encourage you to just go ahead and buy it. While the price tag of $19.99 seems high for an app, it really is dirt cheap for such an invaluable tool.
Blink 👌 10/10 would buy again!
It has everything you could wish for: configurable themes, downloadable fonts with powerline symbols and ligatures, SSH and Mosh support, can remap Caps-Lock to escape, and the list goes on and on.
With all this talk about individual apps, let’s not forget the operating system. iOS 11 does a good enough job of multitasking. You can have two windows open at the same time, either in split screen mode or with one app overlaying the main app, like a thin vertical banner. Especially when setting things up, it helps that via iOS' handoff feature you can copy paste things seamlessly between your MacBook and the iPad. That’s very handy when setting up Mosh to copy your SSH keys without leaving a trace say, by using email or the notes app to get them from your MacBook to the iPad.
It’s really weird how using the 12.9" iPad with a keyboard messes with your brain and, albeit subtly, your muscle memory. iOS and macOS slowly merge together and soon enough you’ll catch yourself touching your MacBook’s screen. But whatever, right? Your coworkers touch and smear your screen all day long, so why not do it yourself!
One thing that surprised me was the keyboard shortcut support on iOS. It’s pretty good! Opening and closing browser tabs, jumping to the location bar, selecting text, searching with
cmd+f, tabbing through the running apps and so on - it all just works. And the trusted
cmd+space shortcut I use for Alfred on my computer opens Spotlight on iOS, which does a good enough job at quickly opening or switching to apps.
The keyboard itself works well, too. Especially if you’re switching from a MacBook, the learning curve is super flat and typing will feel completely normal within an hour.
The 12.9" iPad Pro is pretty much what you would get if you ripped the screen off a 13" MacBook Pro. Except it’s much better and contains a full computer. Even though the MacBook’s retina display is a really great display, the iPad Pro’s display is another big step up. I don’t know if it’s the Pro Motion, the True Tone or the Wide color (P3) but the iPad Pro display just looks a lot better than my 2015 MacBook Pro’s.
Like, A LOT better.
The Apple Pencil is another nice addition that I might go into more detail on in another post. I expected it would just be a toy that gets boring after a few weeks tops, but it has stuck and I use it heavily every day.
The other piece of hardware that’s involved is the server - in my case it’s a bare metal machine with an Intel Core i7-2600 and 32GB of RAM at 30€/month, that I was using as a runner for our gitlab CD pipeline at gymhero.me.
- This setup is highly portable, you don’t even have to join a WiFi network
- Battery lasts forever and the iPad runs absolutely silent
- Screen is absolutely gorgeous, it really is
- Doesn’t fry your thighs because docker runs somewhere else
- Apple keyboard works as well as the one on the MacBook Pro
- Touch screen and a pencil
- Unless you have a spare one, this setup comes with a monthly spend for a server
- You can’t work unless you have LTE or WiFi
- It’s not for people using graphical IDEs
You can’t connect an external monitor (don’t mention airplay)Turns out you can connect an external monitor, please see the updates section
- For that matter, you can’t connect any hardware
The last two really are a blocker if you are in a situation where it’s iPad
XOR Laptop. Probably you don’t want to give up using external monitors or other funky hardware, say, a split ergonomic keyboard, which I terrorize my coworkers with:
The iPad Pro with Apple’s Smart Keyboard in conjunction with a server running ZSH, tmux and neovim makes a fantastic portable development machine that leaves very little to wish for.
The comment section is over at Hacker News and you will now follow @jannis on twitter 🕺
This article got more traction than expected, I got a ton of interesting responses, so here are a couple of updates:
2017/10/26: Reddit gets me!
Comment from discussion The iPad Pro as main computer for programming.
2017/10/26: You can use USB keyboards with the iPad
https://t.co/eIpwJSJe1P if you’re curious; USB keyboards will work just like the usual Smart Keyboard does — Сомелье (@Jonathan_x64) October 26, 2017
Here is the Dockerfile for zsh/tmux/neovim
Stephan Raaijmakers noted that you can, in fact connect external monitors to the iPad:
One small comment: it is of course definitely possible to connect an external monitor to an IPP with the USB-C connector (or beamer). Either through VGA or HDMI. I do this all the time.