24

I'm on the Ruby track and I'm in the installation process of Ruby on Rails.

I'm trying to install gems but it's not happening and i'm not sure why and how to fix it.

$gem install bundler

ERROR:  Loading command: install (LoadError)
dlopen(/Users/nthulanemakgato/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-    darwin13.0/openssl.bundle, 9): Library not loaded:     /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /Users/nthulanemakgato/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-    darwin13.0/openssl.bundle
  Reason: image not found -     /Users/nthulanemakgato/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass

Here is one of the solutions that i've tried:

$CONFIGURE_OPTS="--with-openssl-dir=brew --prefix openssl" rbenv install 2.1.1

rbenv: /Users/nthulanemakgato/.rbenv/versions/2.1.1 already exists
continue with installation? (y/N) y
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...

BUILD FAILED

Inspect or clean up the working tree at     /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-build.20140429120202.53716
Results logged to /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-    build.20140429120202.53716.log

Last 10 log lines:
x yaml-0.1.6/win32/vc6/test_reader.dsp
x yaml-0.1.6/win32/vc6/run_loader.dsp
x yaml-0.1.6/win32/vc6/run_parser.dsp
x yaml-0.1.6/win32/vc6/example_reformatter_alt.dsp
x yaml-0.1.6/win32/vc6/example_deconstructor.dsp
x yaml-0.1.6/win32/vc6/libyaml.dsw
x yaml-0.1.6/win32/vc6/yaml.dsp
/var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-build.20140429120202.53716/yaml-  0.1.6 /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-build.20140429120202.53716 ~
configure: WARNING: unrecognized options: --with-openssl-dir
configure: error: expected an absolute directory name for --prefix: openssl

BUILD FAILED

Inspect or clean up the working tree at     /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-build.20140429120202.53716
Results logged to /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-  build.20140429120202.53716.log

Last 10 log lines:
x yaml-0.1.6/win32/vc6/run_loader.dsp
x yaml-0.1.6/win32/vc6/run_parser.dsp
x yaml-0.1.6/win32/vc6/example_reformatter_alt.dsp
x yaml-0.1.6/win32/vc6/example_deconstructor.dsp
x yaml-0.1.6/win32/vc6/libyaml.dsw
x yaml-0.1.6/win32/vc6/yaml.dsp
/var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-build.20140429120202.53716/yaml-        0.1.6 /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-build.20140429120202.53716 ~
configure: WARNING: unrecognized options: --with-openssl-dir
configure: error: expected an absolute directory name for --prefix: openssl
make: *** No targets specified and no makefile found.  Stop.

I have openssl-1.0.1g installed

I'm using Mac 10.9.2
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
rbenv 0.4.0-97-gfe0b243

This is not like other questions in that i'm using rbenv whereas others ask rvm related questions which I can't use.

Thanks in advance.

Coolkid
  • 407
  • 1
  • 4
  • 13
  • `Library not loaded: /usr/local/opt/openssl/lib...` << you're missing openssl. The [rbenv wiki](https://github.com/sstephenson/ruby-build/wiki) provides instructions for installing it –  Apr 28 '14 at 20:22
  • @user2062950 I've just added that I have openssl installed. But the directions in the link you shared are for Ruby 1.9.3p-0 or lower and mine is 2.1.1. – Coolkid Apr 29 '14 at 10:30
  • did you figure this one out @Coolkid ? – Magne Dec 12 '14 at 17:49

5 Answers5

11

I found that although I already had openSSL installed I needed to brew upgrade ruby before it was recognized. Another maze of twisty little passages, all alike.

holdenweb
  • 33,305
  • 7
  • 57
  • 77
8

It looks like you need to install OpenSSL first. So try to install it:

$ brew install openssl

And then you need to recompile ruby with OpenSSL:

$ CONFIGURE_OPTS="--with-openssl-dir=brew --prefix openssl" rbenv install 2.1.1-p76

iSunRise
  • 106
  • 3
  • I have `openssl-1.0.1g` installed. When I try your second line of code and it says `ruby-build: definition not found: 2.1.1-p76 You can list all available versions with 'rbenv install --list'.` even though the version is already installed. – Coolkid Apr 29 '14 at 10:24
  • Run 'rbenv install --list' and select one of available versions. Then change my second line to: '$ CONFIGURE_OPTS="--with-openssl-dir=brew --prefix openssl" rbenv install ***here your version***' – iSunRise Apr 29 '14 at 10:58
  • I think the issue OP is running into is the errant space in CONFIGURE_OPTS. For documentation on it, see [usage](https://github.com/sstephenson/ruby-build#usage). – Andy Apr 29 '14 at 23:14
  • So to get the actual options you can pass to `./configure`, run `rbenv install --keep `, which will keep the Ruby source in `~/.rbenv/sources/`. In there, run `./configure --help`. – Andy Apr 29 '14 at 23:32
0

When I checked my

rbenv local

and

rbenv global 

they we different.

So I set

rbenv local 2.6.5

and it resolved my issue

Kapidis
  • 129
  • 2
  • 7
0

I saw a similar error out of nowhere too one day…
I just removed then reinstalled ruby, and the error was fixed.

greybeard
  • 2,249
  • 8
  • 30
  • 66
Lily Li
  • 61
  • 1
  • 1
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/30566064) – xom9ikk Dec 15 '21 at 19:55
-5

try to use this code in cmd

chcp 1252
qusai safa
  • 46
  • 6