# "permission deinied" when installing Rails on OS/X

**URL:** <https://www.ruby-forum.com/t/permission-deinied-when-installing-rails-on-os-x/118180>\
**Category:** Rails\
**Created:** [October 24, 2007, 3:53pm UTC](https://www.ruby-forum.com/t/permission-deinied-when-installing-rails-on-os-x/118180 "2007-10-24T15:53:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@ronny](https://www.ruby-forum.com/u/ronny)\
**Post date:** [October 24, 2007, 3:53pm UTC](https://www.ruby-forum.com/t/permission-deinied-when-installing-rails-on-os-x/118180/1 "2007-10-24T15:53:32Z")

</div>

When I do a

gem install -r rails --include-dependencies

it works fine on Linux, but when I do it from a OS/X bash shell, I get  
the error message

Permission denied - /usr/local/lib/ruby/gems/1.8/cache/  
activesupport-1.4.4.gem

The error is reproducible. What could be the problem?

Ronald

---

<div class="post-metadata">

**Author:** ![ronny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@ronny](https://www.ruby-forum.com/u/ronny)\
**Post date:** [October 24, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/permission-deinied-when-installing-rails-on-os-x/118180/2 "2007-10-24T15:59:58Z")

</div>

dear sir

you have to use sudo when installing gems.

---

<div class="post-metadata">

**Author:** ![ronny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@ronny](https://www.ruby-forum.com/u/ronny)\
**Post date:** [October 24, 2007, 4:00pm UTC](https://www.ruby-forum.com/t/permission-deinied-when-installing-rails-on-os-x/118180/3 "2007-10-24T16:00:33Z")

</div>

put the word “sudo” before the word “gem” and it will ask for your  
password  
and should then work fine.

---

<div class="post-metadata">

**Author:** ![ronny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@ronny](https://www.ruby-forum.com/u/ronny)\
**Post date:** [October 24, 2007, 4:08pm UTC](https://www.ruby-forum.com/t/permission-deinied-when-installing-rails-on-os-x/118180/4 "2007-10-24T16:08:09Z")

</div>

On Oct 24, 2550 BE, at 17:52, Ronny wrote:

> The error is reproducible. What could be the problem?

You probably should use sudo.  
sudo gem install rails --include-dependencies

---

<div class="post-metadata">

**Author:** ![ronny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@ronny](https://www.ruby-forum.com/u/ronny)\
**Post date:** [October 24, 2007, 4:39pm UTC](https://www.ruby-forum.com/t/permission-deinied-when-installing-rails-on-os-x/118180/5 "2007-10-24T16:39:49Z")

</div>

I was able to narrow the problem further:

First, I found that I can not do a switch user to root (because of  
rejecting the password, as explained in my  
previous posting), but I can do, for example, a

su admin

and this account corresponds to my Mac OS/X administrator account. So  
I tried first

gem install -r rails --include-dependencies

from the admin account - but now I get the error message

Could not find rails (\> 0) in any repository

This puzzles me, because on Linux, the same works fine. Note that I  
usually get this error message only  
when I forget the ‘-r’ option in the gem install command.

A side remark regarding the suggestion of using “sudo” for the  
install: I found that even though I can do  
a “su admin”, when I do a

sudo -u admin …

the same password which was happily accepted by “su”, is now rejected.

---

<div class="post-metadata">

**Author:** ![ronny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@ronny](https://www.ruby-forum.com/u/ronny)\
**Post date:** [October 24, 2007, 4:15pm UTC](https://www.ruby-forum.com/t/permission-deinied-when-installing-rails-on-os-x/118180/6 "2007-10-24T16:15:46Z")

</div>

On Oct 24, 3:58 pm, “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> you have to use sudo when installing gems.

I see!

But there is one strange thing: When I enter the password of my Mac OS  
administrator account,  
it is rejected by sudo! First I thought I used the wrong password, but  
no: I can reproducibly switch  
to my Mac Administrator account using this password, but when I supply  
it to ‘sudo’, it is not  
accepted.

It looks to me like a “mismatch of account names”: When I list /etc/  
passwd from my bash shell,  
I get (of course) the user “root” as administrator. From the Mac  
viewpoint, I have no user named  
“root”, but I have an user with name “Administrator” having  
administrator privileges (and of this,  
I know the password of course). However I can not remember having ever  
created a separate  
password for the root user in the “Unix compatibility box”.

Any idea how I could resolve this?

Ronald

---

<div class="post-metadata">

**Author:** ![ronny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@ronny](https://www.ruby-forum.com/u/ronny)\
**Post date:** [October 24, 2007, 5:16pm UTC](https://www.ruby-forum.com/t/permission-deinied-when-installing-rails-on-os-x/118180/7 "2007-10-24T17:16:15Z")

</div>

If you run sudo, you must enter the password for the user you’re running  
sudo for. So, if you’re logged in as user john, and you type sudo  
something, you must enter john’s password.

Hope that helps…
