Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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 0.0.0.0.3000 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
add comment

3 Answers

up vote 1 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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.