Why? 🤔️#
Indeed, this demand sounds quite interesting. Who would have nothing to do and write code on their phone/iPad? But isn't it cool? Imagine being able to pick up your phone and write projects anytime, anywhere, and they are truly pushable.
In fact, there is a long history of coding on mobile devices. Geeks have pushed devices to their limits; let's not even talk about productivity—just this alone is pretty cool! 🤩
So, if you still have a curious and adventurous heart, keep reading, and I promise you'll be able to show off in front of your friends in no time.
Step One: Inventory. 🧾#
We have clarified our goals:
- Be able to truly write code.
- Be able to run it locally.
- Be able to submit it to my remote repository.
I searched the App Store and found some pretty good options:
1. Code App 30¥#
Code App is a completely open-source project. It has a friendly interface and version management, a simple command line, and supports writing and running in over a dozen languages, most of which are web-based. Currently, it supports local execution of Node.js, Python, C, C++, and PHP.
For front-end developers, it is absolutely friendly because almost all front-end frameworks can run on it. The support for other languages is also quite good, but it is very unfriendly for users without a keyboard; the operation is quite awkward. If you can afford a Magic Keyboard, it would be a perfect development tool.
But!#
Although Code is powerful, it does not meet our desire to tinker anytime and anywhere, and since the terminal is a fake one, there are a lot of limitations.
2. C Code Develop 5¥#
C Code Develop is developed by a Chinese developer, allowing you to write small toys anytime and anywhere, and you can upload them to the author's little store. The author has created many fun things, such as bringing SwiftUI into it, writing small programs, creating small components, getting your own IP, sending GET requests...
Moreover, the most important thing is that the interface is really super nice, and you can customize the background. The code not only has syntax highlighting but also features auto-completion!
But!#
It does not support git... Not only that, but there is also no command line...
ish 0¥#
ish is a completely open-source free Linux emulation software running on iOS. You can use an almost complete Alpine Linux on it. You might wonder, "Doesn't Apple never allow virtual machines in the App Store?" Small thinking! How can this emulator be called a virtual machine?
In short, with this thing, you can almost happily try Linux on your iPhone or iPad, and then run back to the graphical interface.
There is a lot of information about this software, both domestically and internationally. You can run almost all programming languages on it, such as C, Python 3, Python 2, Lua, OCaml, which I have tried. Unfortunately, it currently does not support Node and Rust; of course, I also tried dotnet, which also cannot run (by the way, I think the best software to run dotnet on iOS/iPadOS is Continuous). Its kernel version is still Alpine Linux 3.14, while Rust only supports Alpine Linux starting from 3.18...
The most important thing is that it also supports git (after all, it is half a Linux system).
But!#
This thing hasn't been developed for long, and the author is still diligently updating it. There are indeed many issues, and many things are not perfect, but it is already the best on iOS/iPadOS.
Overall, it seems that only ish can roughly meet our requirements. Moreover, having a terminal on a phone is just too cool!
Now, let's start tinkering!
Begin! 🤩#
First, download ish and then open it!
You will find that it really looks like a terminal, and you won't find any settings.
Actually, the settings are in the lower right corner; the following image shows the basic operations. The circled part is the settings.
Alright! After personalizing it, it's time for real programming!
Pre-setup! 🎼#
We need to configure the package manager first.
The command for the package manager here is apk
.
For some well-known reasons, we need to change the source to download packages properly. Enter the following in the terminal:
sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && apk update
Wait for the command to finish running, and then you can happily install!
You can also customize the source in /etc/apk/repositories
. Remember to run apk update
after editing!
Download! Configure! ⬇️📦⚙️📄#
We need to install some essential things.
The software comes with gcc and make, but once you actually start writing, you'll find that they are not usable; at this point, we need to download a "patch."
Enter the following in the terminal:
apk add build-base
If your software does not come with essential items like gcc and make, you can download them in the same way.
apk add gcc make
Or you can use clang if you prefer, whatever you like.
Now, when you write a piece of code and compile it, you won't be missing header files anymore!
Now, we also need git; just add it as before:
apk add git
If you want, you can also download editors like vim, nvim, nano, emacs, etc. Just add them as before!
Note ⚠️#
There is a small issue here; on the iPhone, nvim is quite unstable (or rather, not stable), and vim can also act up after configuration. But there is no such problem on the iPad; I suspect it might be a screen size issue.
About Git ⬆️📊#
Git is an indispensable tool for developers. There are some issues in ish that prevent git from connecting to GitHub normally, but we can still push using personal tokens.
First, download git:
apk add git
Then perform the most basic configuration, such as email and username; I won't elaborate on these; if you don't know, please Google it.
We need to create a new project on GitHub and create a personal token in the settings for 30 days or longer.
After modifying the project, when pushing, GitHub will prompt you to log in. At this point, entering your password will not work; you need to enter your personal token to push normally.
Finally#
Life goes on, and so does tinkering!