How to install therubyracer gem on 10.10 Yosemite? - ruby

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 native extensions with: '--with-system-v8'
This could take a while...
Successfully installed libv8-3.16.14.3
Parsing documentation for libv8-3.16.14.3
Installing ri documentation for libv8-3.16.14.3
Done installing documentation for libv8 after 0 seconds
1 gem installed
02:05 $ gem install therubyracer -v '0.12.1' -- --with-system-v8
Building native extensions with: '--with-system-v8'
This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/usr/local/var/rbenv/versions/2.1.2/bin/ruby extconf.rb --with-system-v8
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/var/rbenv/versions/2.1.2/bin/ruby
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/therubyracer-0.12.1 for inspection.
Results logged to /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/therubyracer-0.12.1/gem_make.out

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

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)

None of the answers work for me this time. I have too use this:
brew tap homebrew/versions
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-315
bundle install
Seen on the rubyracer Github issues.
Hope it helps someone else.

Maybe it will be useful for someone but I had problems installing therubyracer (because of the problems with libv8) the solution was to uninstall all the libv8 that I had installed. Install therubyracer
$ gem uninstall libv8
$ gem install therubyracer -v '0.12.0'
Fetching: libv8-3.16.14.7-x86_64-darwin-14.gem ( 57%)
Fetching: libv8-3.16.14.7-x86_64-darwin-14.gem (100%)
Successfully installed libv8-3.16.14.7-x86_64-darwin-14
Building native extensions. This could take a while...
Successfully installed therubyracer-0.12.0
2 gems installed
I hope this helps someone.

It seems like this has been fixed upstream. What worked for me and #aurels and #Mike Causer and #Juanda was:
bundle update libv8

This worked for me very well on my Yosemite and Ruby 2.1.5 (Ruby through RVM)
gem install libv8 -v '3.16.14.3' -- --with-system-v8
Earlier it was giving me error Gem::Ext::BuildError: ERROR: Failed to build gem native extension. for libv8 gem version 3.16.14.3

Only this works for me in my Yosemite, Ruby 2.1.2:
gem install libv8 -v '3.16.14.3' -- --with-system-v8
brew link --overwrite v8-315 --force
gem install therubyracer -v '0.12.2' -- --with-system-v8

I was able to proceed with ruby racer after rm Gemfile.lock
beforehand:
I installed v8 via brew install v8, and then did gem install libv8 -v '3.16.14.3' -- --with-system-v8
and I am running 10.10 Yosemite

They have corrected this issue in the most recent version of libv8. See: https://github.com/cowboyd/libv8/issues/123
You should install from the github repo, in rails I added a line to my gemfile like this gem "libv8", git: "git://github.com/cowboyd/libv8.git", submodules: true
EDIT:
This apparently only solves some of the problem. I installed the new version of libv8, but now the rubyracer is still looking for the other one I think? Still looking into it.

I had the same issue on Yosemite. My solution is similar to what appears above.
Use gem uninstall libv8 to remove anything that might be installed.
Leave therubyracer in your Gemfile, but remove any explicit reference to libv8.
Run bundle install.
libv8 then installed fine as a dependency.

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.

After hours of trying simply upgrading ruby worked:
brew install ruby
and then adding the following to gem file:
gem 'libv8'
gem 'therubyracer'

A heads up to anyone that might have been having my issue: I ended up uninstalling my ruby version in RVM and then reinstalling it. That seemed to use the correct dependancies in the latest version of xcode tools for compiling ruby.
rvm list
rvm uninstall ruby-x.x.x
rvm install ruby-x.x.x

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

this happens due to some conflicts with the libv8 as well, although you can just assign a version to the rubyracer and it will be installed:
change the following in the gemfile:
gem 'therubyracer', '~> 0.12.1'
and do bundle install

What worked for me, based on the following comment,
https://github.com/cowboyd/therubyracer/issues/304#issuecomment-62046085
was to remove Gemfile.lock and then run bundle install

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

Using homebrew's directory of v8 for --with-v8-dir=/usr/local/Cellar/v8#3.15/3.15.11.18_1, instead of /usr/local/opt/v8-315, is what worked for me, in coding addicted's answer.
This is visible in the Summary of the brew install command, brew install v8-315.

Related

Not able to install Jekyll because of therubyracer error on mac

I am trying to run Jekyll and I have the following contents in the Gemfile
source "https://rubygems.org"
gem 'jekyll-auth'
gem 'redcarpet'
gem 'jekyll-lunr-js-search'
gem 'rouge'
gem 'jekyll-sitemap'
I am running bundle install for installing the dependencies specified. Everything works fine until it tries to install a gem called therubyracer. Then the process is stopped by throwing the following error:
Installing nokogiri 1.11.3 (x86_64-darwin)
Fetching libv8 3.16.14.19
Installing libv8 3.16.14.19 with native extensions
Fetching ref 2.0.0
Installing ref 2.0.0
Fetching therubyracer 0.12.3
Installing therubyracer 0.12.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/therubyracer-0.12.3/ext/v8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210430-34242-1i9kf2u.rb extconf.rb --with-v8-dir\=/usr/local/opt/v8#3.15
checking for -lpthread... yes
checking for -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using
--with-system-v8, you have chosen to use the version (Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.
However, your system version of v8 could not be located.
Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
from /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/therubyracer-0.12.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/therubyracer-0.12.3 for inspection.
Results logged to
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/therubyracer-0.12.3/gem_make.out
An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.3' --source 'https://rubygems.org/'` succeeds
before bundling.
In Gemfile:
jekyll-lunr-js-search was resolved to 3.3.0, which depends on
therubyracer
Now for fixing this error, I have tried the following commands as specified in some of the posts
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-315
But this is again giving the same error. I have tried
bundle config build.libv8 --with-system-v8
bundle config build.therubyracer --with-v8-dir=$(brew --prefix v8#3.15)
But there is no luck. I tried by specifying the brew based path for v8, in the command as follows:
sudo gem install therubyracer -- --with-v8-dir= /usr/local/Cellar/v8#3.15
Even after doing all these, I am stuck with the same error which says our system version of v8 could not be located.
I am trying this on a Mac machine with BigSur 11.2.3 is installed and the Ruby version is ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20] and gem is of version 3.0.3.
It will be of great help if someone can tell me how this error can be fixed and I can install and run Jekyll successfully.
I encountered same problem two years ago. I found that libv8 3.16.14.19 is not compatible with therubyracer 0.12.3 and wrote a post to record my solution.
Try the following steps:
Clean up your system
gem uninstall -a libv8
gem uninstall -a therubyracer
Install libv8 with specific version before installing therubyracer
gem install libv8 -v '3.16.14.15'
Install therubyracer
gem install therubyracer -v '0.12.3'
Update libv8 to the version specified in your gemfile
bundle
There may still have problem in macOS BigSur 11.2.
If it raises fatal error: 'climits' file not found in Step 2, try this:
gem install libv8 -v '3.16.14.15' -- --with-system-v8
If it raises errors in Step 3, try this:
brew install v8-315
gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8#3.15

Issues serving Jekyll to localhost, eventmachine 1.2.7 has an error when installing

Not sure what to do to specifically fix this problem, googled and nothing solved my question. When I try to:
bundle exec jekyll serve
I get told:
Could not find eventmachine-1.2.7 in any of the sources
Run `bundle install` to install missing gems.
Then I:
bundle install
Only to get this:
Installing eventmachine 1.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /private/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/gems/eventmachine-1.2.7/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20201130-34411-pd54nh.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
extconf failed, exit code 1
Gem files will remain installed in /var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/gems/eventmachine-1.2.7 for
inspection.
Results logged to
/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/extensions/universal-darwin-20/2.6.0/eventmachine-1.2.7/gem_make.out
An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
minima was resolved to 2.5.1, which depends on
jekyll-feed was resolved to 0.13.0, which depends on
jekyll was resolved to 4.0.0, which depends on
em-websocket was resolved to 0.5.1, which depends on
eventmachine
Where am I going wrong here? Just updated to macOS 11.0.1, this is my first time trying to serve jekyll since the update. Thanks y'all!
Just try:
gem install eventmachine -v '1.2.7' -- --with-cppflags=-I/usr/local/opt/openssl/include
I had the same problem on Big Sur and this solution worked perfectly:
How to fix Jekyll after upgrading to MacOS 11 (Big Sur)
Download XCODE 12 beta from here and copy it to the Applications folder.
Then follow these steps to install rbenv.
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility. see: https://github.com/rbenv/rbenv#basic-github-checkout
xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
Now in your Jekyll project's root, you should be able to run bundle install and it should install all missing dependencies and should work now.
I didn't have to build ruby or install XCode. While Jekyll requires Ruby 2.4.0 or higher and Big Sur comes with 2.6.3, I followed Jekyll's instructions to install the latest version of Ruby.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ruby
Add Ruby to your shell configuration in .bash_profile.
PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH
Install bundler. I had to upgrade to Jekyll 4.2 from 4.0, and install webrick which is no longer a default gem with Ruby 3.0. If Jekyll is installed globally, then install it, webrick, and any other gems, like jekyll-paginate, too.
gem install --user-install bundler jekyll
Add the gems path to your shell configuration in .bash_profile, replacing X.X with with first two digits of the Ruby version.
PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"
export PATH

'gem install -v' installs wrong version of a gem

I'd like to install bundler v1.2.3 on my machine.
First, I checked out the remote gem repo whether that version of the gem exists:
$ gem list --remote | grep "^bundler "
bundler (1.2.3)
Then I tried to install the gem, but a different version(v1.1.5):
$ sudo gem install bundler -v '1.2.3'
Successfully installed bundler-1.1.5
1 gem installed
Installing ri documentation for bundler-1.1.5...
Installing RDoc documentation for bundler-1.1.5...
Why is this happening and is there any solution for this problem?
Thanks!
Just tested on my Mac running 10.8, worked no problem. I had Bundler 1.3.5 already installed.
andys-MacBook-Pro:.gem uw$ gem list 'bundler'
*** LOCAL GEMS ***
bundler (1.3.5)
andys-MacBook-Pro:.gem uw$ gem install 'bundler' -v '1.2.3'
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
Parsing documentation for bundler-1.2.3
Installing ri documentation for bundler-1.2.3
1 gem installed
I'm getting the gem (bundler 1.2.3) installed properly in my Win 7 32 bit machine. give a try again
C:\Windows\System32>gem install bundler -v 1.2.3
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
1 gem installed
Installing ri documentation for bundler-1.2.3...
Installing RDoc documentation for bundler-1.2.3...
When I used gem install bundler '1.2.3'
I got the following.
PS C:\Users\....> gem install bundler '1.2.3'
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
ERROR: Could not find a valid gem '1.2.3' (>= 0) in any repository
But it worked fine when I remove the quotation marks and just used
gem install bundler 1.2.3
EDIT ~ Didn't see the comment to the previous answer. Looks like this question is already solved.
I noticed that you use sudo to do the install but not to do the list. This can sometimes cause a problem, especially if you have multiple versions of ruby/gem installed (or if you use rvm).
I've also seen oddities like this if one of the gems is not using rubygems.org as the default gemserver. What does $ sudo gem list --remote | grep "^bundler " give you?
It may not matter but what version of ruby are you using?

`gem install therubyracer` fails on Mac OS X Lion

I would appreciate some help in getting gem install therubyracer to work. Here is the error:
$ gem install therubyracer
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/david/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for main() in -lobjc... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/david/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-objclib
--without-objclib
extconf.rb:15:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError)
Here are some notable steps that I ran before the error. They worked fine:
$ gem install libv8
$ brew install v8
My environment is:
Mac OS X Lion 10.7.4
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0] (via rvm)
V8 version 3.9.24 (via homebrew)
This worked for me:
$ gem uninstall libv8
$ gem install therubyracer
(A big thanks to http://www.ruby-forum.com/topic/4306127)
gem uninstall libv8
brew install v8
gem install therubyracer
But, why is this happening, you ask? And why does uninstalling libv8 and reinstalling therubyracer fix the problem?
The answer is at the bottom of the error message (from orig post). Ignore the stuff about
probably lack of necessary libraries and/or headers
This is an incorrect assumption by whoever wrote that error message. At the bottom, you see what Ruby has to say about it:
undefined method `include_path' for Libv8:Module
In my case, I was trying to install therubyracer-0.9.8 with bundle install, and for some reason, it was trying to use my copy of libv8-3.11.8.13, which had been installed at some point, probably as a dependency of some other gem.
I don't know why it was trying to use the newer version, because therubyracer.gemspec contains s.add_dependency "libv8", "~> 3.3.10". And my Gemfile.lock says to use libv8 (3.3.10.2). But alas, that is indeed what was happening.
And it's true that Libv8:Module does not have the method include_path in libv8-3.11.8.13, but it does in libv8-3.3.10.2
So that is why uninstalling all of your versions of libv8 and then re-installing therubyracer works. Because all the versions of libv8 that do not have the method include_path are removed completely, and the libv8 that does have the method include path is reinstalled when you reinstall of therubyracer.
Considering none if the above worked for me 100%, I thought I'd post what did (as part of a rails project):
gem uninstall libv8
bundle update therubyracer
This made sure I got the latest therubyracer, and also a more recent version of libV8, and seem to fix the multiple issues I was hitting, from missing libv8.a files, to undefined methods.
At last I use therubyracer 0.11.0beta5 as a solution.
Using therubyracer (0.11.0beta5)
add following on Gemfile
gem 'therubyracer', '~> 0.11.0beta5'
group :libv8 do
gem 'libv8', "~> 3.11.8"
end
then bundle install
Mac OSX 10.8 Moutain Lion
If you need 0.11.3 and it's failing give this a shot for Mac OS X 10.9...
gem uninstall libv8
brew install v8
gem install libv8 -- --with-system-v8
gem install therubyracer -v '0.11.3' -- --with-system-v8
See this issue for more details.
You probably don't need the -- --with-system-v8 on the last line but I did it just to be safe since I saw it start doing Fetching: libv8-3.11.8.17-x86_64-darwin-13.gem (1%) when I ran the command...
Anyhow, it worked for me when all the other things did not.
For anyone encountering this issue on Mac OSX 10.8 Mountain Lion when attempting to upgrade their Gemfile with gem 'therubyracer', '0.11.0', just upgrading the system libv8 gem worked for me (no uninstallation of any other gem necessary):
$ gem update libv8
$ bundle install
Edit
If you use Travis-CI (or other CI tools located on other servers, I assume), you will need to explicitly add the libv8 gem to your Gemfile as well:
Gemfile
gem 'libv8', '3.11.8.3'
then bundle install as usual. Just note that libv8 can take a significant amount of time to install and I've noticed that it may end up being the cause of going over Travis CI's timeout limits, causing your build to fail. You can mitigate this slightly be not including development environment gems in your builds:
.travis.yml
# ...
bundler_args: --binstubs=./bundler_stubs --without development
Update
Yep, pretty much all my Travis builds timeout and fail because of this. If anyone knows a way to solve this problem (I would hope "downgrade therubyracer" is a last resort), please leave a comment!
Update 2
This may not work for all apps, but it seems that my Rails 3.2.9 apps didn't actually need therubyracer or libv8 after all. After removing those gems from my Gemfile, I confirmed that my specs passed, pushed again to Travis and it built successfully. So, I guess getting rid of those gems (if you're not sure you actually need them) is at least worth a try.
Update 3
Thanks to Paul Annesley for confirming that if you're on Mac OS X 10.8 Mountain Lion, you don't need therubyracer gem at all since the OS already comes bundled with Apple JavaScriptCore, its own Javascript runner. At the time of the original answer, I was on Snow Leopard and hence needed it.
For me, removing the Gemfile.lock file and running bundle install worked it's magic.
OSX 10.8.2, ruby 1.9.3p125
None of the above worked for me... I got tired of trying to find the right gem for my environment, so I just soft linked to the g++ target this things was missing:
sudo ln -s `which g++` /usr/bin/g++-4.2
Not as helpfully for remote deployments, but get the job done on my workstation.
I got a similar issue, but it was also complaining about not finding g++-4.2. I did have XCode command line tools installed, but it was looking for /usr/bin/g++-4.2, I had g++ (which was a symbolic link pointing to llvm-g++-4.2). Anyway, I just created a symbolic link to g++ and tried the bundle install again... it worked!
$ cd /usr/bin
$ sudo ln -s g++ g++-4.2
Had the same error, this worked for me:
From console: gem uninstall libv8
In your Gemfile, add the following:
gem 'therubyracer', :platforms => :ruby, :require => 'v8'
gem 'libv8', '~> 3.11.8' # Update version number as needed
From console: bundle install
If you were in the middle of upgrading therubyracer gem, you may want to run bundle update therubyracer after that as well. (Consider specifying a version number)
This was on Mac 10.6 (Snow Leopard).

bcrypt-ruby won't install with bundler but works fine with gem install

I just recently began having trouble with bundler - bcrypt-ruby will not install when doing a bundle install or sudo bundle install and exits with the following error:
Installing bcrypt-ruby (2.1.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
Gem files will remain installed in /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4 for inspection.
Results logged to /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4/ext/mri/gem_make.out
An error occured while installing bcrypt-ruby (2.1.4), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '2.1.4'` succeeds before bundling.
However, gem install bcrypt-ruby -v '2.1.4' runs just fine (and in fact has already been run on this box). Running /usr/bin/ruby1.8 extconf.rb manually works just fine, and the resulting Makefile also runs with make just fine.
I'm using Ruby 1.8.7 and bundler 1.0.21 on Ubuntu 10.04.1 LTS. Other gems seem to be working fine through bundler. Though this is probably obvious, I've confirmed that the ruby-dev, gcc, etc packages are installed. I've tried using the --deployment option with bundler with no different behavior. The only thing I can think that has changed recently is I did a bundle update a couple days ago, so bundle got a minor version change (1.0.10 -> 1.0.21) and bcrypt appears to have gotten a major version change (2.1.4 -> 3.0.1).
Any help is appreciated!
Have you upgraded to Lion since you installed Ruby 1.9.2? If so it is probably linked to the wrong gcc.
Try uninstalling and reinstalling 1.9.2, I would suggest using rvm
rvm uninstall 1.9.2
rvm install 1.9.2
If that does not work you might have to implode rvm
rvm implode
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source ~/.bash_profile
rvm install 1.9.2
try:
sudo apt-get install build-essential

Resources