Search code examples
ruby-on-railsrubytermux

How to install a specific version of ruby-dev on termux


I'm trying to setup ruby on rails environment on termux on android. I want to use 2.1.10 ruby. All I found was apt install ruby-dev or pkg install ruby-dev which installs the latest version of ruby. any suggestions?


Solution

  • You can install rvm.
    0. Recomendation: install tmux and zsh, and change zsh as default shell. Oh my Zsh worked. Powerline fonts too (by install termux-style script)

    Let's install rvm:

    1. Install gawk, curl and tar packages:
      apt install curl gawk tar
    2. Go to rvm.io site and just copy 'Install RVM' command, look' like:
      curl -sSL https://get.rvm.io | bash -s stable
    3. Add this line [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" to your ~/.bashrc or ~/.zshrc file
    4. Now your shell must writing a syntax PS problem, just open rvm script and edit it:
      vi ~/.rvm/scripts/rvm
      Now you must found a block like:
     case "`uname` in
    (CYGWIN*|MINGW*)
    ... etc ... 
    

    Just replace the 3 initialization variable __shell_name strings with this:

    __shell_name="gawk 'BEGIN{RS=\"\"}; NR==1{print; exit
    }' /proc/$$/cmdline | tr - '\0'" ;;
    
    1. Restart shell
    2. Now you can install ruby from rvm. Usage at rvm.io
      P.s.: jruby not supported while you don't found solution for install jdk and jre from Termux).
      P.s.: sorry for bad English.

    Update

    RVM working with termux: https://github.com/rvm/rvm/issues/4734