Running rails server - ruby-on-rails

I am coming up against issues running a rails server on a local environment. I am on Mac OS X 10.10. I think they relate to the osx-gcc-installer.
Running in Terminal:
$ rails server
Results in:
Your Ruby version is 2.0.0, but your Gemfile specified 1.9.3
Cool, so then I run:
$ rvm install 1.9.3-p550
Which results in:
-bash: rvm: command not found
This solves that:
$ source ~/.bashrc
So I run this again:
$ rvm install 1.9.3-p550
Which produces this:
Warning, new version of rvm available '1.26.1', you are using older version '1.26.0'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-1.9.3-p550.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
password required for 'softwareupdate -l':
Checking requirements for osx.
Installing requirements for osx.
Updating system.....
Installing required packages: gcc48, libyaml, libksba......
Error running 'requirements_osx_brew_libs_install gcc48 libyaml libksba',
showing last 15 lines of /Users/<user>/.rvm/log/1415842393_ruby-1.9.3-p550/package_install_gcc48_libyaml_libksba.log
++ case "$1" in
++ [[ -t 1 ]]
++ return 1
++ printf %b 'There were package installation errors, make sure to read the log.
Try `brew tap --repair` and make sure `brew doctor` looks reasonable.
Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installation\n'
There were package installation errors, make sure to read the log.
Try `brew tap --repair` and make sure `brew doctor` looks reasonable.
Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installation
++ case "$_system_version" in
++ return 1
Requirements installation failed with status: 1.
So, as it suggests, I try:
brew tap --repair
Which says:
Pruned 0 dead formulae
Tapped 161 formulae
And run:
brew doctor
Which gives two warnings both mentioning osx-gcc-installer (which I stupidly installed as part of the Team Treehouse instructions for setting up a dev environment):
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: You have an outdated version of /usr/bin/install_name_tool installed.
This will cause binary package installations to fail.
This can happen if you install osx-gcc-installer or RailsInstaller.
To restore it, you must reinstall OS X or restore the binary from
the OS packages.
Warning: You seem to have osx-gcc-installer installed.
Homebrew doesn't support osx-gcc-installer. It causes many builds to fail and
is an unlicensed distribution of really old Xcode files.
Please run `xcode-select --install` to install the CLT.
I run:
xcode-select --install
And get this:
Usage: xcode-select -print-path
or: xcode-select -switch <xcode_folder_path>
or: xcode-select -version
Arguments:
-print-path Prints the path of the current Xcode folder
-switch <xcode_folder_path> Sets the path for the current Xcode folder
-version Prints xcode-select version information
Which doesn't seem to have done anything so I fetch the CLT from https://developer.apple.com/downloads/index.action# (which I'm pretty sure I had beforehand), install, and reboot.
Do I really need to reinstall my OS to solve this problem? That seems like overkill and I'm hoping somebody has another solution.
Update
On the suggestion of a commenter, I tried this:
$ rvm use 1.9.3 --default
Which returned:
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for an example.
So I tried the steps here and
$ source ~/.rvm/scripts/rvm
And re-ran:
$ rvm use 1.9.3
Which resulted in
ruby-1.9.3-p550 is not installed.
To install do: 'rvm install ruby-1.9.3-p550'
So I checked which versions I had using
$ rvm list
And got
rvm rubies
ruby-1.9.3-p0-falcon [ x86_64 ]
ruby-1.9.3-p545 [ x86_64 ]
Then ran:
$ rvm use 1.9.3-p0-falcon --default
And tried:
$ rails server
Which resulted in:
Could not find bcrypt-ruby-3.0.1 in any of the sources
Run `bundle install` to install missing gems.
But bundle install outputs:
/Users/<username>/.rvm/rubies/ruby-1.9.3-p0-falcon/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/<username>/.rvm/rubies/ruby-1.9.3-p0-falcon/lib/ruby/1.9.1/x86_64-darwin13.1.0/openssl.bundle, 9): Library not loaded: ##HOMEBREW_CELLAR##/openssl/1.0.1j/lib/libcrypto.1.0.0.dylib (LoadError)
Referenced from: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Reason: image not found - /Users/<username>/.rvm/rubies/ruby-1.9.3-p0-falcon/lib/ruby/1.9.1/x86_64-darwin13.1.0/openssl.bundle
from /Users/<username>/.rvm/rubies/ruby-1.9.3-p0-falcon/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/<username>/.rvm/rubies/ruby-1.9.3-p0-falcon/lib/ruby/1.9.1/openssl.rb:17:in `<top (required)>'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/vendor/net/http/persistent.rb:201:in `<class:Persistent>'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/vendor/net/http/persistent.rb:191:in `<top (required)>'
from /Users/<username>/.rvm/rubies/ruby-1.9.3-p0-falcon/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/<username>/.rvm/rubies/ruby-1.9.3-p0-falcon/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/vendored_persistent.rb:3:in `<top (required)>'
from /Users/<username>/.rvm/rubies/ruby-1.9.3-p0-falcon/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/<username>/.rvm/rubies/ruby-1.9.3-p0-falcon/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/fetcher.rb:1:in `<top (required)>'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/cli.rb:247:in `install'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/vendor/thor/command.rb:27:in `run'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/vendor/thor/base.rb:440:in `start'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/cli.rb:10:in `start'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/bin/bundle:20:in `block in <top (required)>'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/gems/bundler-1.5.3/bin/bundle:20:in `<top (required)>'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/bin/bundle:23:in `load'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon#global/bin/bundle:23:in `<main>'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon/bin/ruby_executable_hooks:15:in `eval'
from /Users/<username>/.rvm/gems/ruby-1.9.3-p0-falcon/bin/ruby_executable_hooks:15:in `<main>'
Which looks a bit more serious, but at least it isn't telling me to reinstall my OS.

Related

Homebrew: Cask 'java' definition is invalid

I started getting the following error when updating my casks recently:
Error: Cask 'java' definition is invalid: Token '{:v1=>"java"}' in header line does not match the file name.
I'm on MacOS 10.14.4, and my Homebrew version:
→ brew --version
Homebrew 2.1.2
Homebrew/homebrew-core (git revision 6811d1; last commit 2019-05-11)
Homebrew/homebrew-cask (git revision ba4e3; last commit 2019-05-11)
Here's the output of brew cask upgrade --verbose --debug:
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
angular-cli atlassian-cli libpqxx terraforming
app-engine-python elasticsearch osm2pgrouting
asciidoctorj jenkins-lts postgresql
==> Casks with `auto_updates` or `version :latest` will not be upgraded
==> Upgrading 1 outdated package:
Error: Cask 'java' definition is invalid: Token '{:v1=>"java"}' in header line does not match the file name.
/usr/local/Homebrew/Library/Homebrew/cask/cask_loader.rb:73:in `cask'
/usr/local/Caskroom/java/.metadata/1.8.0_51-b16/20150725210402.758/Casks/java.rb:1:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/cask_loader.rb:62:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/cask_loader.rb:62:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/cask_loader.rb:178:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/upgrade.rb:39:in `block in run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/upgrade.rb:37:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/upgrade.rb:37:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/abstract_command.rb:36:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:92:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:158:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:123:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:9:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:162:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:162:in `rescue in run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:146:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:123:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:9:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'
and the output of brew tap:
beeftornado/rmtree
heroku/brew
homebrew/cask
homebrew/core
homebrew/services
Here's the output of brew doctor if it helps:
→ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
/Users/myUser/anaconda3/bin/icu-config
/Users/myUser/anaconda3/bin/krb5-config
/Users/myUser/anaconda3/bin/freetype-config
/Users/myUser/anaconda3/bin/xslt-config
/Users/myUser/anaconda3/bin/libpng16-config
/Users/myUser/anaconda3/bin/python3.6m-config
/Users/myUser/anaconda3/bin/libpng-config
/Users/myUser/anaconda3/bin/xml2-config
/Users/myUser/anaconda3/bin/python3-config
/Users/myUser/anaconda3/bin/curl-config
/Users/myUser/anaconda3/bin/ncursesw6-config
/Users/myUser/anaconda3/bin/pcre-config
/Users/myUser/anaconda3/bin/python3.6-config
/Applications/Postgres.app/Contents/Versions/9.4/bin/gdal-config
Warning: Some installed formulae are not readable:
dotwrp: Unsupported special dependency :fortran
(base)
I've searched but cannot seem to find a way to fix this.
Any suggestions?
Solved by doing the following:
Edited the java cask:
vim /usr/local/Caskroom/java/.metadata/1.8.0_51-b16/20150725210402.758/Casks/java.rb
Changed the first line from:
cask :v1 => 'java' do
to
cask 'java' do
Removed the undent comments at the end of the cask, which were giving me problems.
Ran brew uninstall --cask java
Problem solved 💥
You can clean up old-style cask formulas thus:
grep "cask :v1 =>" --files-with-match /usr/local/Caskroom/*/.metadata/*/*/Casks/*.rb \
| xargs gdirname | xargs gdirname | xargs rm -r
Assuming you've installed coreutils with a g prefix, so gdirname runs the GNU flavor of dirname

bin/rails generate model error, bundler/setup (LoadError)

I'm setting up a rails environment, following instructions from this:
Copy, paste, and run the following, one line at a time:
sudo rvm implode
If it says sudo: rvm: command not found, that's fine.
sudo rm -rf ~/.rvm
brew ls --versions rbenv
If nothing shows up after you run "brew ls --versions rbenv", copy, paste, and run the following:
brew install rbenv
brew install ruby-build
Copy, paste, and run:
open ~/.bash_profile
In the text editor:
Search (command+F) for "rvm", and delete any lines that have it.
Copy and paste the following at the bottom:
export PATH="$HOME/.rbenv/bin:$PATH"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
Save and quit.
Copy, paste, and run:
rbenv install 2.1.2
rbenv global 2.1.2
and then going through this tutorial
http://tutorials.jumpstartlab.com/projects/blogger.html
Now I'm just trying to run the bin/rails generate model command from my project dir and I'm getting this error
/Users/me/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
from /Users/me/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/me/Desktop/DevProjects/blogger/config/boot.rb:3:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'
I see other questions with 'generate' causing problems, but none with my specific error. All I could surmise was that it seemd like I was missing a gem called 'bundler/setup' so I did installed that. Now, using the same comamnd bin/rails generate model Article, it told me that I didn't have rake, so I did gem install rake, and then it said I don't have 'i18n' and then I realized its just going through the gems that weer installed with 'bundler' one by one.
I feel like something is going on that is completely beyonod the scope of my understanding of how the PATH works, program environments, etc.

Homebrew not working after I installed 'sudo gem install rails'

After running any homebrew command I get the same error over and over......
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- extend/module (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/local/Library/Homebrew/global.rb:1:in <top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/local/Library/brew.rb:16:in'
The best idea – use rvm.
First of all reinstall homebrew.
Then install rvm:
\curl -sSL https://get.rvm.io | bash -s stable
Then you need to provide ruby version and gemset. Go to app folder and create files .ruby-version and .ruby-gemset (including dot). Then add version and gemset in this files. Simple way to do it via console. In console, go to app directory, then:
echo ruby-2.1.3 >> .ruby-version
echo gemsetname >> .ruby-gemset
Of course, provide ruby version that you need. Gemsetname is often equal to app name. So, if your app is called coolapp, your gemsetname should be coolapp. Smth like this:
echo coolapp >> .ruby-gemset
Now, leave app directory and try to enter it again via console:
cd /path/to/your/app
RVM will generate everything you need automatically and you will see stmth like this:
ruby-2.1.3 - #gemset created /Users/username/.rvm/gems/ruby-2.1.3#coolapp
ruby-2.1.3 - #generating coolapp wrappers..........
Boya! This approach will provide same version and gemset name for every developer because files will be included in git. And that will decrease bug level. Everything you need from this moment, just use:
bundle install
And everything should goes right!
I would recommend using rbenv or rvm to manage your development Ruby version and gems. Editing OS X's system Ruby could cause difficult-to-diagnose problems.
Also, you shouldn't need to sudo to install gems. You need to be very careful when sudoing a command since, again, it could cause difficult-to-diagnose problems with the operating system down the road.
So, I'd recommend you re-install homebrew, then install rbenv from git, then gem install away.

Fixing Ruby on OS X Yosemite

I am getting the following error:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- psych (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/yaml.rb:5:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/bin/hub:190:in `<main>'
I've tried the suggestions on Stack Overflow which are related libyaml and psych. However, many of those require rvm commands which return the following error:
rvm reinstall 2.0
/Users/richardburton/.rvm/src/ruby-2.0.0-p247 has already been removed.
Removing /Users/richardburton/.rvm/rubies/ruby-2.0.0-p247 - please wait
Error running '__rvm_rm_rf /Users/richardburton/.rvm/rubies/ruby-2.0.0-p247',
please read /Users/richardburton/.rvm/log/1401921952_ruby-2.0.0-p247/remove.rubies.log
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-2.0.0-p247.
Obviously there are a rvm binaries available at this stage. Any tips or suggestions on how I can get Ruby 2.0 up and running would be much appreciated.
Thanks!
The first error you are receiving is referencing your system ruby, and you're reinstalling with rvm. Try running which ruby. Most likely this can be fixed by updating your path. I wouldn't recommend reinstalling the system ruby, so I'd definitely recommend getting whatever was causing the first error to work with rvm.
If that still isn't working, I'd next try using rbenv instead of rvm. I'm personally a fan of rbenv and have had no issues with my Ruby using it. It's super easy to get up and running, and could be a good temp fix.
$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile # or whichever profile you are using
$ source ~/.bash_profile # or whichever profile you are using
$ rbenv install <version number>
$ rbenv global <version number>
Links to rbenv info:
rbenv: https://github.com/sstephenson/rbenv
ruby-build: https://github.com/sstephenson/ruby-build#readme
rvm package install libyaml
rvm reinstall 1.9.3 --with-libyaml-dir=/home/rails/.rvm/usr
I had the same error and this worked for me
Source: https://serverfault.com/questions/442150/how-to-fix-ruby-installation-is-missing-psych-for-yaml-output-on-centos
I've bumped into the same issue and I have tried two solutions:
1) Using ruby-build to build ruby-2.0-p451 with prefix /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr --> DOES NOT WORK (GOT SEGMENTATION FAULT)
2) Replace with the stock version shipped with OSX 10.9 ---> WORKS!!
Please see my snippet on how to do it here: https://gist.github.com/joneslee85/73ece54ba5b3a17e8bb2
Now I can go to sleep. Good luck!

LoadError: dlopen(digest/sha1.bundle): Symbol not found: _rb_Digest_SHA1_Finish

Ruby stopped working on my brother's machine recently.
gem commands
rails server
rails console
All failed with the following error:
$ irb
irb(main):001:0> require 'digest/sha1'
LoadError: dlopen(~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle, 9): Symbol not found: _rb_Digest_SHA1_Finish
Referenced from: ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle
Expected in: flat namespace
in ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle - ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle
from ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from (irb):1
from ~/.rbenv/versions/2.0.0-p0/bin/irb:12:in `<main>'
He tried different versions of Ruby. Reinstalling everything with rvm. Running rvm implode and reinstalling rvm. Switching to rbenv. Several Rubies installed via ruby-build. brew install ruby.
All had the same problem.
If he uninstalled all rubies, the OS supplied version in /usr/bin/ruby worked. But it's 1.8.7.
After hours of troubleshooting, we arrived at the solution below. I hope it helps you avoid some pain.
Possible solutions:
$ unset C_INCLUDE_PATH and reinstall Ruby
This is the solution that worked for me.
$ echo $C_INCLUDE_PATH
If C_INCLUDE_PATH is set, it will break Ruby builds. Remove it from your environment; either temporarily with $ unset C_INCLUDE_PATH, or permanently (might be in .bashrc, .profile, .bash_profile); then reinstall ruby.
It might be related to OpenSSL, RVM, XCode's Command Line Tools (gcc), or other build issues.
See this answer if the previous solution didn't work.
For anyone, like me, coming here because of an error like this:
LoadError: dlopen(/Users/sebkomianos/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/sebkomianos/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
One solution (taken from here) might be to reinstall your version of ruby. eg: rbenv install 2.0.0-p247

Resources