Random Tech Thoughts

The title above is not random

SaaS Class Environment Set Up on OS X

Update

ruby-debug-base19 version 0.11.25 does not work with ruby 1.9.3-p0 on OS X. I found a workaround on WyeWorks Blog. Here’s my modified gist to install the working version with RVM managed ruby-1.9.3-p0


I’m taking the SaaS class. The class project can be done using the pre-created VirtualBox image or on Amazon EC2 virtual machine, but I want to do it directly on my Mac because its more convenient for me. Luckily, there is instructions on how to configure a bare VM.

Looking into the configure script used to configure the ubuntu VM shows that there is nothing special in the software used. It just needs some ruby gems, PostgreSQL, and Sphinx. (The script will also install and configure Vim, Emacs, but that’s not relevant to me.) Configuring the environment on OS X should be easy, if you are not using Xcode 4.3.

If you are using Xcode 4.3, first create link for gcc-4.2, otherwise the native extension for ruby gems can’t be built:

cd /usr/bin
sudo ln -s llvm-gcc-4.2 gcc-4.2
sudo ln -s llvm-g++-4.2 g++-4.2

So here’s the ruby gems (I recommend to use RVM to create a new gemset):

gem install rails -v 3.1.0
gem install rspec-rails -v 2.6.1
gem install cucumber -v 1.0.6
gem install nokogiri -v 1.5.0
gem install capybara -v 1.1.1
gem install rcov -v 0.9.10
gem install haml -v 3.1.3
gem install sqlite3 -v 1.3.4
gem install uglifier -v 1.0.3
gem install heroku -v 2.8.0
gem install execjs
gem install therubyracer
gem install flog
gem install flay
gem install reek
gem install rails_best_practices
gem install bundler
gem install haml
gem install simplecov
gem install factory_girl
gem install ruby-tmdb
gem install taps
gem install thinking-sphinx
gem install ruby-debug19

Next install PostgreSQL and Sphinx. I’m using Homebrew:

brew install postgresql
brew install sphinx

The script given in the instructions uses PostgreSQL 8.4, but I guess there will not be some big problems using the 9.1 version. If you want to install a previous version of PostgreSQL, look the answer on Stack Overflow on how to install a specific version of formula in Homebrew.

Sphinx installation is very likely to fail if you are using Xcode 4.3. Look this Homebrew issue for workaround. I followed claymation’s configure setting and manually built sphinx:

cd ~/Library/Caches/Homebrew/
tar xf sphinx-2.0.3.tar.gz
cd sphinx-2.0.3
tar xf ../libstemmer_c.tgz
CXX=g++ CXXFLAGS="-Os -w -pipe -Qunused-arguments -D_FILE_OFFSET_BITS=64 \
  -DNDEBUG" CFLAGS="-Os -w -pipe -Qunused-arguments -D_FILE_OFFSET_BITS=64 \
  -DNDEBUG" ./configure --prefix=/usr/local/Cellar/sphinx/2.0.3 \
  --disable-dependency-tracking --localstatedir=/usr/local/var \
  --with-libstemmer --with-pgsql
make install
brew link sphinx

I’m not sure if this setup will work smoothly for the class. I’ll update this post if I encounter any problem.

Comments