Installing calabash on a vanilla mac is not a 2 minutes process. There are number of packages that you will need on your machine in order to make the set up and use of calaba.sh possible.
Those items are:
- Xcode command line tools
- Ruby min version 1.8.7
- RVM (if you don’t want to mess around with your main Ruby install – this is not a MUST but I highly advice you to install it)
This guide will take you through that process.
- Get Xcode (if you haven’t got it – get it at the App Store)
Note – you may need an Apple developer log-in to get the command line tools
- Get the Command Line Tools for Xcode – the easy way to get these is to open Xcode > Got to Xcode on the menu bar, then click Open Developer Tools, then click More Developer Tools… – this will take you to a page will have the latest version of Command Line tools at the top – just download the dog and install.
Check that the command line tools have installed properly by running:
$ gcc —version
You should get a response similar to this:
Configured with: —prefix=/Applications/Xcode.app/Contents/Developer/usr —with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn) Target: x86_64-apple-darwin12.5.0 Thread model: posix
If you get:
clang: error: no input file , don’t panic, you’ve probably typed gcc -version (1 hyphen) instead of gcc —version (2 hyphens)
- Now this is an optional step, but if you don’t have home-brew installed on your mac then I suggest that you do. It is a package manager which makes installing a whole host of tools as easy as stating typing ‘brew’ at the command line.
- As a pre-requisite to doing this, just double check that you have ruby installed and check that the version is at least 1.8.7. To do this enter:
You should see a response saying something like:
ruby 1.8.7 [patch info] [other info].
OK – now to install home-brew – enter at the command line. Please note – you may have to prefix this with sudo or run as admin/root.:
ruby -e “$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)”
When the installation has complete, execute the command brew doctor at the cmd line to check that the install is ok. If there are any problems, go through and fix them one by one…running brew doctor until there are no more issues. – Issues that I encountered were numerous to be honest – such wrong version of Xcode; macports being installed and various other things.
- So we have brew installed – time to install Git. Git is a version control system. The calabash code is held in github.
First thing we do is run at the command line:
It is good idea to get into the habit of running brew update before installing anything – it makes sure we always have the most recent copy.
So to install git – we can use the magic of home-brew by entering the following at the command line:
brew install git
When it’s finished we get something like this before our prompt:
🍺 /usr/local/Cellar/git/1.8.4: 1339 files, 30M
Next thing we do is run ‘brew doctor’ to make sure everything is still ok.
In my case I already had an install of git and had to overwrite it.
Now very your installation of git by entering
$ which git
you should get
Let’s now configure git with you name and email address. so on the command line enter
$ git config —global user.name “Gin AN Tonic”
$ git config —global user.email “email@example.com”
Install RVM (with the latest Ruby on Rails)
- Now this is the last part before calabash itself. We are going to install RVM and while we are at it Ruby on Rails. Go to the command line and enter:
$ \curl -L https://get.rvm.io | bash -s stable —rails —autolibs=enable
When it has finished installing, check it with the following command:
$ type rvm | head -1
response should be
rvm is a function
Now check the versions of both rvm, ruby & rails…enter
$ rvm -v
response should be dvm 1.19.1 or higher
response should be ruby 2.0.0p0 or higher.
$ rails -v
response should be Rails 3.2.13 or higher
Lastly check that everything is ok with homebrew by running brew doctor again. You might seem some messages saying that the kegs in the cellar are unlinked. Brew gives very explicit instructions – follow them and you will easily be able to link, relink or overwrite any kegs which are causing problems in your cellar.
That’s it for the moment.
In PART 2 – using RVM to manage your versions of Ruby, installing calabash and running our first test.