installing rubygems and individual gems on OSX "mountain lion"

Richard Karpinski's Avatar

Richard Karpinski

08 Aug, 2012 06:03 PM

I've recently upgraded by MacBook Pro to OSX "mountain lion" [10.8 (12A269)] and have installed Xcode 4.4.1 with the command line extensions. Still at ruby 1.8.24 (comes with mountain lion) [don't think I need 1.9]:

rick ] gem --version administrators-MacBook-Pro:~/Sites/snm 1.8.24
[ rick ] ruby --version administrators-MacBook-Pro:~/Sites/snm ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

Forgive me, but I am terminally confused about permissions:

I used
ruby setup.rb
on the ruby download

but then tinkered with permissions so a regular user (not administrator, e.g. "rick" see above) could access both ruby and gem.

I think I used

gem install

rather than sudo gem install

but now think that may have been a mistake as I seem to have permission problems again with running some of the installed gems.

Most of the googling I did failed to provide "mountain lion"--or even OSX--specific answers.
Can you set me straight?

Thanks in advance.


  1. Support Staff 1 Posted by Eric Hodel on 08 Aug, 2012 06:13 PM

    Eric Hodel's Avatar

    Please show the output of gem env

    If you have modified the permissions of the Apple Ruby installation you may need to periodically re-apply them. Apple may revert changes you make when you install software updates.

  2. 2 Posted by Richard Karpins... on 08 Aug, 2012 10:07 PM

    Richard Karpinski's Avatar

    [ rick ] gem env administrators-MacBook-Pro:~/Sites/snm RubyGems Environment:
    - RUBYGEMS VERSION: 1.8.24 - RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8 - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby - EXECUTABLE DIRECTORY: /usr/bin - RUBYGEMS PLATFORMS:

    - ruby
    - universal-darwin-12
  3. Support Staff 3 Posted by Eric Hodel on 08 Aug, 2012 10:11 PM

    Eric Hodel's Avatar

    If you change the permissions on /Library/Ruby/Gems/1.8 you may need to periodically reapply your changes.

    You can set all: --user-install in your ~/.gemrc to install gems into your home directory to avoid this extra step, or you can set GEM_HOME to a directory you control to avoid typing sudo.

  4. 4 Posted by Richard Karpins... on 11 Aug, 2012 06:05 PM

    Richard Karpinski's Avatar

    Many thanks for your advice!
    I got things going by adding these lines to .gemrc:

    make install location accessible to 'rick'

    - user-install then needed to put export PATH=$PATH:/Users/rick/.gem/ruby/1.8/bin
    into my bash_profile

    but that seems to let everything work without "sudo".

    A couple of things, though:
    didn't help me figure out how to put things correctly into .gemrc (e.g. "all:" and leading colons in ":sources", ":benchmark", etc.); and it wasn't clarified in

    ....not a complaint, just a plea for more explicit clarification for newbies like me.

    How about a HOWTO for installing (or not) various versions of RUBY under "mountain lion" and one for setting up GEMS in various scenarios under "mountain lion".

    Again, many thanks.


  5. Nick Quaranto closed this discussion on 14 Aug, 2012 01:28 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac