How to programm in Ruby on rails your phone or android tablet

Miyazaki, 2022-11-22

First you will need to install Termux.
In Termux you run the following:

First if you haven't already, make it possible to access the phone drive from termux. This is optional.

ls storage
ls storage/shared

If you run those three commands, you will see the contents of your android phone. The folders in showing up in the second commands are shortcuts. The folders under storage/shared is the topmost directory on your phone.

Install ruby and libraries:

pkg install ruby sqlite libxml2 libxslt

You can now get into ruby by typing irb. Exit by typing exit or ctrl-q

Some ruby gems might not work, in that case you might need to install more libraries. Others might not work for some reason, like nokogiri Lets fix that:

pkg install ruby clang make binutils
pkg install pkg-config libxslt binutils # additional dependencies
gem install nokogiri --platform=ruby -- --use-system-libraries
gem install rails
rails new bookshelf

Open Gemfile with nano and remove the line with tzinfo-data in it.

bundle update
bundle add tzinfo-data
rails server

Open the url in the phone browser to see the rails screen!

You can of course also install hanami or sinatra! Or not use any framework!

You will probably want a text editor on your phone. You can either run one inside linux on termux or you use an android app and select the folder and file in the app. For blog posts, I use iA Writer, but there are editors like ACode which look promising. Consider using micro, nano, emacs or vim because you can use them on all other systems too.


You might be easier to install code server on a VPS to use vscode on android through a server. Gitpod/Github Codespaces is another option. Stay tuned for my article on that!

Learning ruby on your phone


Ruby is a really fun language. I recommend the book text processing with ruby.