Working in VS Code on iPad
About a year ago I blogged about how to turn iPad Pro into a capable coding machine with the help of a remote linux server.
Since then several things have happened:
- New version of iPad Pros were released with the amazing Magic Keyboard that is easier to type on, has trackpad and back-lighting, making iPads way nicer for prolonged, serious work.
- Apple has started limiting background applications to 15 minutes of activity. This creates certain level of annoiance for any SSH client, including the ones described in my blog post (Mosh is much less effected by it, however).
Note: since the server runs in foreground, you probably want to launch it
with tmux (e.g.
tmux new -s coder-server) or screen, so it doesn’t hang
up once you disconnect, from your server.
But other than that - all it takes is to:
- Download the latest tar.gz file from the project releases page with:
- Extract it with
tar xzvf code-server-3.2.0-linux-x86_64.tar.gz
- Choosing a custom port of your liking (unless you want to run on the default
8080, but I would not recommend it). Let’s say we like
- Opening that port up in the firewall with
sudo ufw allow 9797(or: preferrably proxying using Caddy server to https)
- Run it on any port of your choosing, say with
./code-server --bind-addr 0.0.0.0:9797
- Opening the address like
http://126.96.36.199:9797/where we assume that IP is of your server.
- Entering the password you have been given during the server startup (for security), and enjoying your new awesome IDE.
To make sure you don’t have to always start the app from Safari, on your iPad, just click on “share” when you have it first opened in safari, and then scroll down to “Add to Home Screen” to turn the website into an “app”.
Once all is done, you should have something like the setup on the following screenshot:
You may want to also configure HTTPS for your setup, once you know you like it enough to actually use it regularly. Using Caddy Server’s automatic HTTPS via Let’s Encrypt is easier for this, in my opinion, than dealing with certificates yourself.
Thanks to Safari being first-class citizen on iPadOS, your app-ized “VS Code” will be able to even use split-screen functionality! And obviously, VS Code has built-in terminal app, so you don’t even have to set up a separate terminal app or worry about it disconnecting.
P.S. I wrote this blog using the setup described :)