How to set up Cucumber and Watir on OSX

These are the steps I had to use to get Cucumber and Watir running on OSX. It’s a shame about step 1, it’s a real pain but I don’t know any way around it.

  1. Install Xcode from OSX installation DVD – this takes about 15 minutes
  2. Open a command prompt and use enter the following commands.
  3. sudo gem update --system
  4. sudo gem install rspec --no-rdoc --no-ri
  5. sudo gem install gherkin --no-rdoc --no-ri
  6. sudo gem install cucumber --no-rdoc --no-ri
  7. sudo gem install firewatir --no-rdoc --no-ri

You should be good to go.

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.

6 thoughts on “How to set up Cucumber and Watir on OSX”

  1. I think I have read somewhere that Xcode from DVD is not good (not sure if it was for 10.5 or 10.6) so it would be the best to run software update after installing it. Prepare for about 500 MB download.

    Would you cross post this at


    1. I think it’s more than 500MB, plus you have to register as an Apple Developer.
      My aim was to complete the installation in a pomorodo block (25 mins), so this wasn’t achievable. Much easier to stick the install DVD in…


  2. After installing Xcode, you also need to install Xcode command line tools; otherwise the gherkin installation will fail because it can’t build the gem extension.


  3. When I got to the command on gherkin I encountered this error.

    $ sudo gem install gherkin –no-rdoc –no-ri
    Fetching: json-1.7.7.gem (100%)
    Building native extensions. This could take a while…
    ERROR: Error installing gherkin:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
    creating Makefile

    xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -DJSON_GENERATOR -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -O3 -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c generator.c
    xcode-select: Error: No Xcode is selected. Use xcode-select -switch /Applications/ to select /Applications/, or see the xcode-select manpage (man xcode-select) for further information.
    Error: /usr/bin/xcode-select returned unexpected error.
    make: *** [generator.o] Error 1

    Any suggestions?

    I installed xcode from app store not from DVD.


Comments are closed.