Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OS X Mavericks broke rbenv?

Recently, I installed OS X Mavericks, and it seemed to have messed up my development environment. I got this message after running 'rails new first_app':

Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:

    bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.

Password: 
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.9.0)
Using atomic (1.1.15)
Using thread_safe (0.2.0)

Errno::EACCES: Permission denied - /Library/Ruby/Gems/2.0.0/build_info/tzinfo-0.3.39.info
An error occurred while installing tzinfo (0.3.39), and Bundler cannot continue.
Make sure that `gem install tzinfo -v '0.3.39'` succeeds before bundling.

I then did what was asked of me:

christohersmbp2:hartl christopherspears$ gem install tzinfo -v '0.3.39'
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

What is weird is that I do have rbenv installed. In fact, while trying to debug this issue, I upgraded rbenv:

christohersmbp2:~ christopherspears$ brew update
Already up-to-date.
christohersmbp2:~ christopherspears$ brew upgrade rbenv ruby-build
Warning: A newer Command Line Tools release is available
Update them from Software Update in the App Store.
Error: rbenv-0.4.0 already installed
Error: ruby-build-20140225 already installed

However, I get this error message when I try to call rbenv from the command line:

christohersmbp2:hartl christopherspears$ rbenv
-bash: rbenv: command not found
christohersmbp2:~ christopherspears$ rbenv rehash
-bash: rbenv: command not found

I think I have the path set up properly:

christohersmbp2:hartl christopherspears$ echo $PATH
/usr/local/share/python:/Users/christopherspears/.rbenv/bin:/Users/christopherspears/bin:/usr/local/heroku/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin

This is what I have in my .bash_profile file:

# rbenv stuff
export PATH="$HOME/.rbenv/bin:$PATH"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

Strangely enough, I do think I am using the Ruby version in my versions folder:

christohersmbp2:versions christopherspears$ pwd
/Users/christopherspears/.rbenv/versions
christohersmbp2:versions christopherspears$ ls
2.0.0-p247/
christohersmbp2:versions christopherspears$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

Any hints? I seem to be doing everything correctly.

UPDATE:

I downloaded and installed the Xcode command line tools. Didn't seem to work:

christohersmbp2:~ christopherspears$ rbenv -bash: rbenv: command not found

like image 698
Christopher Spears Avatar asked Mar 11 '14 23:03

Christopher Spears


1 Answers

As @Christoper Spears say, uninstall then reinstall, or more specifically:

$ brew uninstall rbenv
$ brew install rbenv

(supposing you used brew to install it in the first place).

like image 58
Jon Burgess Avatar answered Sep 20 '22 16:09

Jon Burgess