Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Aware that this is a bit mental, but can I install Ruby on a Galaxy S4 running Jelly Bean 4.2? A console where I can install gems, rake routes and run the Rails server, and browse to my application by putting into Chrome?

Would be excellent for testing little ideas and concepts I have while on the go!

Aware that Android isn't UNIX, but good God if they can install it on Windows, they can install it anywhere!

share|improve this question
You have some good answers below, any reason why you have not upvoted them ? – Siddharth Jun 14 '13 at 6:29
up vote 3 down vote accepted

The Android Scripting Environment said to plan on Ruby. Might be worth a check how far they got; at least they're tagged "JRuby" at Google Code. According to their project page:

Scripts can be run interactively in a terminal, in the background, or via Locale. Python, Perl, JRuby, Lua, BeanShell, JavaScript, Tcl, and shell are currently supported, and we're planning to add more.

But be also aware of:

SL4A is designed for developers and is alpha quality software.

An interesting article on this topic which you might want to read is Hacking Android during the holidays. It describes an (successful) attempt to setup and use SL4A to be used with a.o. Ruby.

share|improve this answer

this can be done

  1. Compile Ruby and Nodejs for android
  2. Install on device and configure with c/c++ ide (You can use C4droid,CCTools,Terminal IDE.... for installing the expansion modules on с/с++)
  3. Install rails ($gem install rails)

Screenshot 1 Screenshot 2 Screenshot 2 (Click image to enlarge)

share|improve this answer

As for ruby, you may try Termux.

With batteries included. Can you imagine a more powerful yet elegant pocket calculator than a readline-powered python console? Up-to-date versions of perl, python, ruby and node.js are all available.

share|improve this answer

In theory, yes you could do this, but there would be some significant limitations. You'll almost certainly need a rooted Android device.

For instance, you wouldn't be able to just gem install anything and have it work. The problem is, the phone is too resource-limited to run a compiler, so you can't compile either Ruby, or any gem that needs native libraries.

So the first way I'd go about this would be to cross-compile ruby and RubyGems with the Android NDK and then side-load them onto the device. At this point you've got ruby and gem and can start experimenting.

share|improve this answer

Actually, I modified CyanogenMod to create empty "/bin, /lib, /usr, /var, /svr, /home, /media, etc, etc" and then modified "${source_root}/system/core/include/private/android_filesystem_config.h" to include rules for the directories and then modified my external sdcard so it wouldn't mount as fuse or with the sticky bit set (it would set root:sdcard_rw ownership to all file inside) and after start up I ran a script that mounted the Linux arm root directories on the external sdcard to the empty versions in Android's root. The embedded version of glibc was used with a Kali Linux armhf chroot image I created, but it didn't have ruby or metasploit. So I followed some directions about compiling ruby 1.9.3 with svn or something and then used that to install metasploit, the only thing was that postgresql didn't work because socket and file creation are very permission sensitive and sockets may have been involved, so no postgres database, have yet to try to connect to a db on another host though. Apache2 worked, I did the whole /etc/init.d/apache2 start and viola, "It Works!" you know that if you've seen it.

So in short, yes, you can compile ruby and many more programs on Android, glibc just has to be available, ie /lib directory and contents on Linux.

And as a side note, I used a Galaxy S III Sprint with 2GB of RAM. Python works great, I just started experimenting with Unix sockets with python, they connected in /sdcard but I need to learn more about Android's security policies on sockets and database creation before I move any further with getting metasploit and working with a database working on Android + glibc.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.