Saturday, March 3, 2012

Install gettc on macbook

gettc is a very convenient tool for downloading TopCoder problems (description, test cases etc.) and practice offline. This post summarizes how I installed gettc on my macbook air.
  1. Mac OS X Lion ships with ruby 1.8.7, and gettc requires ruby>=1.9. So our first step is to install a newer ruby
    1. Install rvm, and use it to install new ruby. Follow the steps here
    2. Set the new ruby as default. Follow the steps here
  2. Next install prerequisites of gettc.
  3. Next install gettc. Follow the instructions here. After it's done, change the first line (location of ruby) in `which gettc`. The location of ruby can be found by `which ruby`.
  4. Set up the PATH by adding the following line to ~/.bash_profile:
  5. Modify "~/.gettc/template/solve/cpp/Makefile" to remove the option "-std=gnu++0x". Modify "~/.gettc/template/bin/" to remove the option "-o $ostream".

If your machine is Ubuntu or other unix variants, and you don't have root privilege, you can use the above steps as well.

No comments: