Why? 🤔️#
Indeed, this requirement sounds interesting. Who would have nothing better to do than to write code on their phone/iPad? But isn't it cool? Just imagine, being able to pick up your phone anytime, anywhere and start coding, and actually be able to push it.
In reality, there is a long history of coding on mobile devices. Geeks have pushed the limits of these devices, and even though it may not be very productive, it's still pretty cool 🤩!
So, if you still have that curious and adventurous spirit burning inside you, keep reading, and I promise you'll soon be able to show off your skills to your friends.
Step 1: Make a List 🧾#
Let's clearly define our goals:
- To be able to write code for real.
- To be able to run it locally.
- To be able to push it to my remote repository.
I've searched through the App Store and found some good options:
1. Code App ¥30#
Code App is a completely open-source project. It has a user-friendly interface and version control, with a simple command line. It supports writing and running code in over ten different languages, although most of them are web-based. Currently, it supports local running of Node.js, Python, C, C++, and PHP.
For front-end developers, it's absolutely friendly because almost all front-end frameworks can run on it. It also has good support for other languages. However, it's not very user-friendly for those without a physical keyboard, and the operations can be quite awkward. If you have the money to buy a Magic Keyboard, then it's the perfect development tool.
But!#
Although Code is powerful, it doesn't meet our requirement of being able to code anytime, anywhere. Also, it has many limitations because the terminal is not real.
2. C Code Develop ¥5#
C Code Develop is developed by a Chinese developer. It allows you to write small programs anytime, anywhere, and even upload them to the developer's app store. The developer has created many interesting things, such as porting SwiftUI, writing small programs, creating widgets, getting your own IP address, sending GET requests, and more.
The most important thing is that the interface is really beautiful, and you can customize the background. It not only has syntax highlighting but also auto-completion!
But!#
It doesn't support Git... Moreover, it doesn't even have a command line...
ish Free#
ish is a completely open-source and free Linux emulator running on iOS. You can use it to run a nearly complete Alpine Linux on your device. You might wonder, "Isn't Apple against virtual machines on the App Store?" Well, think again! This emulator is not a virtual machine!
With ish, you can almost enjoy Linux on your iPhone or iPad, and then quickly switch back to the graphical interface.
There is so much to say about this software, and it has users both in China and abroad. You can run almost any programming language on it, such as C, Python 3, Python 2, Lua, and OCaml. Unfortunately, it doesn't support Node.js and Rust yet. I also tried .NET, but it couldn't run (by the way, if you want to run .NET on iOS/iPadOS, I think the best software is Continuous). The kernel version is still Alpine Linux 3.14, and Rust only supports Alpine Linux starting from version 3.18.
The most important thing is that it supports Git (after all, it's like half a Linux system).
But!#
This software is still in its early stages of development, and the author is constantly updating it. There are still many issues and incomplete features, but it's currently the best option for iOS/iPadOS.
Based on the overall evaluation, it seems that ish is the closest to meeting our requirements. And let's not forget how cool it is to have a terminal on your phone!
Now, let's get started!
Begin! 🤩#
First, download ish and open it!
You'll see that it looks just like a terminal, but you won't find any settings.
Actually, the settings are in the bottom right corner. The image below shows the basic operations, with the settings circled.
Great! After personalizing it, it's time to start coding for real!
Preparations before getting started! 🎼#
We need to configure the package manager first.
The package manager's command here is apk
.
Due to some well-known reasons, we need to change the source in order to download packages properly. In the terminal, enter the following command:
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 packages!
You can also customize the source in /etc/apk/repositories
. Remember to run apk update
after editing the file!
Download! Configure! ⬇️📦⚙️📄#
We need to install some necessary things.
The software already comes with gcc and make, but you'll find that they are not sufficient when you actually start writing code. In that case, we need to download a "patch".
In the terminal, enter:
apk add build-base
If your software doesn't come with gcc and make, you can also download them in the same way.
apk add gcc make
Or if you prefer using clang, you can do that too, as per your preference.
Now, when you write a piece of code and try to compile it, you won't encounter any missing header file errors!
Next, we need Git. Just add it using the same method:
apk add git
If you want, you can also download editors like vim, nvim, nano, or emacs. Just add them in the same way!
Note⚠️#
There is a small issue here: nvim is not very stable on iPhones (or rather, it's not stable at all), and vim goes crazy after configuration. However, on iPads, there are no such problems. I suspect it might be due to the screen size.
About Git⬆️📊#
Git is an essential tool for developers, but there are some issues with ish that prevent Git from connecting to GitHub properly. However, we can still push our projects using a personal access token.
First, download Git:
apk add git
Then, perform the basic configuration, such as setting up your email and username. I won't go into too much detail here, but you can easily find instructions online if you're not familiar with it.
We need to create a new repository on GitHub and generate a personal access token with a duration of 30 days or longer in the settings.
When you try to push your changes to the repository, GitHub will prompt you to log in. At this point, entering your password won't work, so you need to enter your personal access token instead to complete the push operation.
Finally#
Life never stops, and neither does tinkering!