I don\'t manage to install therubyracer gem on Yosemite 10.10.
Here is the log:
11:53  $ gem install libv8 -v \'3.16.14.3\' -- --with-system-v8
Building         
        This solution worked for me following Jakub Troszok's solution above with just a minor change
gem uninstall libv8
gem install therubyracer -v '0.12.1'
    Fetching: libv8-3.16.14.19-x86_64-darwin-18.gem (100%)
    Successfully installed libv8-3.16.14.19-x86_64-darwin-18
    Building native extensions.  This could take a while...
    Successfully installed therubyracer-0.12.1
    Parsing documentation for libv8-3.16.14.19-x86_64-darwin-18
    Installing ri documentation for libv8-3.16.14.19-x86_64-darwin-18
    Parsing documentation for therubyracer-0.12.1
    Installing ri documentation for therubyracer-0.12.1
    Done installing documentation for libv8, therubyracer after 0 seconds
    2 gems installed
gem install libv8 -v '3.16.14.17' -- --with-system-v8  (if the libv8 version required for your project is different from the one installed by rubyracer)
bundle install
It seems like this has been fixed upstream. What worked for me and @aurels and @Mike Causer and @Juanda was:
bundle update libv8
I did the following
gem install therubyracer
which now installs therubyracer 0.12.1 which installs the dependency libv8 (3.16.14.7 x86_64-darwin-14) which installed with no errors.
I did this using ruby 2.1.5 which I installed via: 
CC=/usr/bin/gcc rbenv install 2.1.5
which I did after running brew upgrade ruby-builds.
After installing ruby 2.1.5, I also ran 
gem upgrade --system
to get rubygems-update 2.4.5
gem uninstall libv8
brew install v8
gem install therubyracer
gem install libv8 -v '3.16.14.3' -- --with-system-v8
this is the only way it worked for me on 10.10 (ruby 2.1.2)
Or try gem install libv8 -v 'XX.XX.XX' -- --with-system-v8 adding the version of the gem :) 
UPDATE for Mac OS Catalina:
brew tap homebrew/versions
brew install v8@3.15
brew link --force v8@3.15
gem install libv8 -v 'XX.XX.XX' -- --with-system-v8
gem install therubyracer
Updated answer for 2018.
I'm on High Sierra, on Homebrew 1.6.1
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8@3.15/
Is what worked for me.
Credit goes to @coding-addicted for his original answer.
git clone https://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake clean build binary
gem install pkg/libv8-3.16.14.3-x86_64-darwin-12.gem #note that libv8 version may change, so tab through files in pkg/, also remember to use the one with version specified
then just bundle your project gems
this is the only way it worked for me on 10.10 (ruby 2.1.2)