Trouble with RVM permissions when executing a command line 'bundle install'

Hello,

I heard from 37signals that this is where the go to people hang out for
Ruby on Rails. I included a full screenshot of my Terminal interaction,
as well as a “brief” explanation below.

I am taking a Ruby on Rails class on Skillshare.com. It’s a great class,
but I’m just learning programming. RoR is starting to make some sense to
me, but I am having trouble with the final lesson, which is getting it
online. I’ve asked our class and instructor (who is very good, no
disrespect) for help and haven’t been able to solve it yet. I’m begging
for someone to help me.

I’m on a Macbook running 10.7x. When I run ‘bundle install’, from the
command line, it starts ‘Fetching data…’ and ‘Resolving dependencies.’

Then after it says “Using multi_json (1.8.4)”, I get this error:

=====>
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.

/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
*** 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.

An error occurred while installing atomic (1.1.14), and Bundler cannot
continue.
Make sure that gem install atomic -v '1.1.14' succeeds before
bundling.

ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions into the
/usr/local/rvm/gems/ruby-1.9.3-p392 directory.

<============

Any help would be great. I have installed XCODE v.4.6.3 (which is the
latest for OS 10.7x) and the development tools that go with it, but
still get the same error message.

BTW,
I am using the command line from the administrator account, but I
previously installed RoR on my personal account on the computer. So I
don’t know if it’s trying to access those files when doing the bundle
install, but I thought it was worth mentioning.

Thanks in advance to anyone willing to help,

Eric

========================================

On Thursday, January 30, 2014 5:41:59 AM UTC, Eric Jefcoat wrote:

ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions into the
/usr/local/rvm/gems/ruby-1.9.3-p392 directory.

That looks like a systemwide install of rvm - normally the rvm folder is
in your home folder so that there are no permission problems. I’d be
very
tempted to remove rvm and reinstall it (when you install rvm, don’t use
sudo - just install it as your regular user)

Fred

Fred,

How do I go about removing rvm? I don’t remember setting up a root user
password on my computer, When I search “Spotlight” for rvm, I get some
other gem and ruby folders it looks like, but not something named rvm.

Thanks for your help,
Eric

You have two options:

  1. fix the permissions:
  • make sure you are in rvm group, run “id” and there should be group
    “rvm”
  • if it is not there run: rvm group add rvm $USER
  • make sure that rvm is up to date and has properly set permissions: rvm
    get stable; rvm fix-permissions
  • restart your computer - it might be required to apply permission
    changes
    and to properly load your environment
  1. uninstall system rvm and install it in home:
  • run: sudo rm -rf /etc/profile.d/rvm.sh /etc/rvmrc /usr/local/rvm
    $HOME/.rvm*
  • make sure your environment is empty of old rvm, run “env | grep rvm”
    if
    it is empty it’s all fine, if not - restart computer to ensure your
    environment is reset
  • install rvm: \curl -L https://get.rvm.io | bash -s stable
  • follow the installation instructions and install ruby: rvm install
    ruby

On Thursday, January 30, 2014 10:56:04 AM UTC, Eric Jefcoat wrote:

Fred,

How do I go about removing rvm? I don’t remember setting up a root user
password on my computer, When I search “Spotlight” for rvm, I get some
other gem and ruby folders it looks like, but not something named rvm.

rvm implode

removes rvm (although I don’t think it does anything much beyond
deleting
the /usr/local/rvm directory). If you had previously installed rvm by
prefixing the install command with sudo, that would have done a system
wide
install if I remember correctly.

Fred

Michael,

Thank you for helping. I followed your directions to fix the
permissions,
and I was able to run the bundle install, without errors!

You are the man!! Thank you so much!
Eric

computer:crumblr admin$ rails server
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in
to_specs': Could not find railties (>= 0) amongst [i18n-0.6.9, minitest-4.7.5, multi_json-1.8.4, rake-10.1.1] (Gem::LoadError) from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:into_spec’
from
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in
gem' from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/rails:18:in
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in
eval' from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in