Sunday, 27 April 2014

calabash ruby: Installing ruby rvm on mac OSX why and how

Why Ruby or RVM ?
Calabash commands needs ruby to be installed for interpreting commands to actions.

Which version of ruby to install ? - 
Check here pre requisites section in this link
Currently its 2.0+

Why Rvm ?  -  RVM is used to manage to rubies on mac 

Alternative to RVM ?  -  use rbenv 

How to install rvm ?
run these command from terminal on mac

$ \curl -sSL | bash -s stable --ruby
(there is a backslash before curl. This prevents misbehaving if you have aliased it with configuration in your ~/.curlrc file)
Then install required version of ruby ..
$ rvm install 2.0.0
$ rvm use 2.0.0
You can set a version of Ruby to use as the default for new shells. Note that this overrides the ‘system’ ruby
$ rvm use 2.1.0 --default

Check here for more documentation -
      • When to clean and install - Check errors section below
      • How to verify RVM installation is successful

      Close existing terminal and reopen new terminal window
      a) type this command in terminal 'open ~/.bash_profile' check if you see code the this 


      [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

      b) type this command 'rvm list'
      check ouput it must be like below

      ~ $: rvm list

      rvm rubies
         ruby-2.0.0-p353 [ x86_64 ]
      =* ruby-2.0.0-p451 [ x86_64 ]

      # => - current

      # =* - current && default
      #  * - default

      c) Ruby version currently used 

      ~ $: ruby -v

      ruby 2.0.0p451 

      Common Issues: While installing calabash gems 
        1) Error during RVM installation
        About to install Homebrew, press `Enter` for default installation in `/usr/local`,
        type new path if you wish custom Homebrew installation (the path needs to be writable for user)
        : Requirements installation failed with status: 1.

        2) ERROR:  While executing gem ... (Gem::FilePermissionError)
            You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
        lon04-04266:~ dakojuu$ sudo gem install calabash-cucumber
        Building native extensions.  This could take a while...
        ERROR:  Error installing calabash-cucumber:
        ERROR: Failed to build gem native extension.

            /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
        checking for main() in -lc... yes
        creating Makefile
          Solution resintall RVM

          No comments:

          Post a Comment