# "igem install rake" raise an System.UnauthorizedAccessException (Windows 7)

**URL:** <https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220>\
**Category:** IronRuby\
**Created:** [January 25, 2010, 12:12pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220 "2010-01-25T12:12:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 25, 2010, 12:12pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/1 "2010-01-25T12:12:47Z")

</div>

Hello,

doing my first real test on Windows 7 - I installed the latest IronRuby  
(using the MSI installer) and igem install rake issues the following  
error:

ERROR: While executing gem … (SystemCallError)  
unknown scenario - System.UnauthorizedAccessException, C:/Program  
Files/IronRuby 0.9.3.0/lib/ironruby/gems, Create

My understanding is that it’s linked to the permissions in Windows 7.

If I manually create the gems folder and allow full control to the  
current  
user (not in administrator mode), then I get the following error:

ERROR: While executing gem … (ArgumentError)  
Illegal characters in path.

Is there anyone currently running the MSI installed version of IronRuby  
on  
Windows 7 without these issues ?

thanks,

– Thibaut

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 25, 2010, 12:15pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/2 "2010-01-25T12:15:43Z")

</div>

## move ironruby to a location without a space in the path like C:\ironruby

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([IronRuby in Action - Ivan Porto Carrero and Adam Burmister | Manning](http://manning.com/carrero))

On Mon, Jan 25, 2010 at 11:56 AM, Thibaut BarrÃ¨re  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 25, 2010, 2:17pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/3 "2010-01-25T14:17:29Z")

</div>

> move ironruby to a location without a space in the path like C:\ironruby

thanks - will try that. Is it worth filing a bug ?

– Thibaut

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 25, 2010, 4:13pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/4 "2010-01-25T16:13:24Z")

</div>

## it’s a known issue that should be fixed in the next release, AFAIK

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([IronRuby in Action - Ivan Porto Carrero and Adam Burmister | Manning](http://manning.com/carrero))

On Mon, Jan 25, 2010 at 1:58 PM, Thibaut BarrÃ¨re

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 25, 2010, 4:21pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/5 "2010-01-25T16:21:36Z")

</div>

> it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 25, 2010, 9:09pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/6 "2010-01-25T21:09:06Z")

</div>

Ivan, do you remember what the known issue is? I can’t remember seeing a  
discussion about UnauthorizedAccessException. Just making sure that the  
bug is really being tracked

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Thibaut  
BarrÃ¨re  
Sent: Monday, January 25, 2010 7:21 AM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 25, 2010, 9:43pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/7 "2010-01-25T21:43:38Z")

</div>

Program files is a protected location and contains a space in the path.  
I  
couldn’t find a workitem. But all the problems would be solved  
by mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though  
[http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969)

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 25, 2010, 10:42pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/8 "2010-01-25T22:42:11Z")

</div>

Added a comment to the workitemâ€¦

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Monday, January 25, 2010 12:43 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.  
I couldn’t find a workitem. But all the problems would be solved by  
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though  
[http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969)

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

On Mon, Jan 25, 2010 at 8:30 PM, Shri B.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Ivan, do you remember what the known issue is? I canâ€™t remember seeing a  
discussion about UnauthorizedAccessException. Just making sure that the  
bug is really being tracked

From:  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
On Behalf Of Thibaut BarrÃ¨re  
Sent: Monday, January 25, 2010 7:21 AM  
To: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 25, 2010, 10:55pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/9 "2010-01-25T22:55:40Z")

</div>

Btw, c:\ironruby will still need admin priviledges to install to, right?

Does the one-click installer make the gem folder writable to all users  
(or atleast all Admin users)? What about on \*nix? Without making the gem  
folder writable, â€œigem installâ€ will still fail. Making the folder  
writable to all users is a security hole, and ideally RubyGems will  
support a way to install to a per-user location, or elevate permission  
otherwise. I believe you need to use â€œsudo gem installâ€ on \*nix.

From: Shri B.  
Sent: Monday, January 25, 2010 1:42 PM  
To: removed\_email\_address@domain.invalid  
Subject: RE: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Added a comment to the workitemâ€¦

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Monday, January 25, 2010 12:43 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.  
I couldn’t find a workitem. But all the problems would be solved by  
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though  
[http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969)

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

On Mon, Jan 25, 2010 at 8:30 PM, Shri B.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Ivan, do you remember what the known issue is? I canâ€™t remember seeing a  
discussion about UnauthorizedAccessException. Just making sure that the  
bug is really being tracked

From:  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
On Behalf Of Thibaut BarrÃ¨re  
Sent: Monday, January 25, 2010 7:21 AM  
To: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 1:47am UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/10 "2010-01-26T01:47:46Z")

</div>

Jim and I were discussing the desired behavior, and it is a choice  
between security and convenience.

> **[Distributing IronPython Packages: distutils, site-packages and PEP 370](http://ironpython-urls.blogspot.com/2009/10/distributing-ironpython-packages.html)**
>
> The basic way of distributing and installing Python libraries (packages), and even scripts and applications, is with distutils which is par...

has information on how Python is dealing with the admin issue. Packages  
(the equivalent of gems) are installed to a per-user location. The  
IronRuby equivalent would be that every user has to install his/her own  
set of gems, and could be implemented by setting the GEM\_PATH  
environment variable for the user to point to something like  
%USERPROFILE%. Any objection to this behavior?

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Monday, January 25, 2010 1:55 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Btw, c:\ironruby will still need admin priviledges to install to, right?

Does the one-click installer make the gem folder writable to all users  
(or atleast all Admin users)? What about on \*nix? Without making the gem  
folder writable, â€œigem installâ€ will still fail. Making the folder  
writable to all users is a security hole, and ideally RubyGems will  
support a way to install to a per-user location, or elevate permission  
otherwise. I believe you need to use â€œsudo gem installâ€ on \*nix.

From: Shri B.  
Sent: Monday, January 25, 2010 1:42 PM  
To: removed\_email\_address@domain.invalid  
Subject: RE: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Added a comment to the workitemâ€¦

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Monday, January 25, 2010 12:43 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.  
I couldn’t find a workitem. But all the problems would be solved by  
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though  
[http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969)

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))  
On Mon, Jan 25, 2010 at 8:30 PM, Shri B.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Ivan, do you remember what the known issue is? I canâ€™t remember seeing a  
discussion about UnauthorizedAccessException. Just making sure that the  
bug is really being tracked

From:  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
On Behalf Of Thibaut BarrÃ¨re  
Sent: Monday, January 25, 2010 7:21 AM  
To: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 2:26am UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/11 "2010-01-26T02:26:59Z")

</div>

Ideally we would be setting GEM\_PATH to somewhere in AppData.

JD

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Monday, January 25, 2010 4:47 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Jim and I were discussing the desired behavior, and it is a choice  
between security and convenience.

> **[Distributing IronPython Packages: distutils, site-packages and PEP 370](http://ironpython-urls.blogspot.com/2009/10/distributing-ironpython-packages.html)**
>
> The basic way of distributing and installing Python libraries (packages), and even scripts and applications, is with distutils which is par...

has information on how Python is dealing with the admin issue. Packages  
(the equivalent of gems) are installed to a per-user location. The  
IronRuby equivalent would be that every user has to install his/her own  
set of gems, and could be implemented by setting the GEM\_PATH  
environment variable for the user to point to something like  
%USERPROFILE%. Any objection to this behavior?

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Monday, January 25, 2010 1:55 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Btw, c:\ironruby will still need admin priviledges to install to, right?

Does the one-click installer make the gem folder writable to all users  
(or atleast all Admin users)? What about on \*nix? Without making the gem  
folder writable, â€œigem installâ€ will still fail. Making the folder  
writable to all users is a security hole, and ideally RubyGems will  
support a way to install to a per-user location, or elevate permission  
otherwise. I believe you need to use â€œsudo gem installâ€ on \*nix.

From: Shri B.  
Sent: Monday, January 25, 2010 1:42 PM  
To: removed\_email\_address@domain.invalid  
Subject: RE: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Added a comment to the workitemâ€¦

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Monday, January 25, 2010 12:43 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.  
I couldn’t find a workitem. But all the problems would be solved by  
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though  
[http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969)

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))  
On Mon, Jan 25, 2010 at 8:30 PM, Shri B.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Ivan, do you remember what the known issue is? I canâ€™t remember seeing a  
discussion about UnauthorizedAccessException. Just making sure that the  
bug is really being tracked

From:  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
On Behalf Of Thibaut BarrÃ¨re  
Sent: Monday, January 25, 2010 7:21 AM  
To: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 2:10am UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/12 "2010-01-26T02:10:00Z")

</div>

Just realized that setting GEM\_PATH will affect MRI too which would be a  
problem. So there will have to be some other way to implement the  
per-user IronRuby-specific location for gems. Assuming we can figure  
this out, the question still is if the per-user gems model sounds goodâ€¦

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Monday, January 25, 2010 4:47 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Jim and I were discussing the desired behavior, and it is a choice  
between security and convenience.

> **[Distributing IronPython Packages: distutils, site-packages and PEP 370](http://ironpython-urls.blogspot.com/2009/10/distributing-ironpython-packages.html)**
>
> The basic way of distributing and installing Python libraries (packages), and even scripts and applications, is with distutils which is par...

has information on how Python is dealing with the admin issue. Packages  
(the equivalent of gems) are installed to a per-user location. The  
IronRuby equivalent would be that every user has to install his/her own  
set of gems, and could be implemented by setting the GEM\_PATH  
environment variable for the user to point to something like  
%USERPROFILE%. Any objection to this behavior?

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Monday, January 25, 2010 1:55 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Btw, c:\ironruby will still need admin priviledges to install to, right?

Does the one-click installer make the gem folder writable to all users  
(or atleast all Admin users)? What about on \*nix? Without making the gem  
folder writable, â€œigem installâ€ will still fail. Making the folder  
writable to all users is a security hole, and ideally RubyGems will  
support a way to install to a per-user location, or elevate permission  
otherwise. I believe you need to use â€œsudo gem installâ€ on \*nix.

From: Shri B.  
Sent: Monday, January 25, 2010 1:42 PM  
To: removed\_email\_address@domain.invalid  
Subject: RE: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Added a comment to the workitemâ€¦

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Monday, January 25, 2010 12:43 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.  
I couldn’t find a workitem. But all the problems would be solved by  
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though  
[http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969)

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))  
On Mon, Jan 25, 2010 at 8:30 PM, Shri B.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Ivan, do you remember what the known issue is? I canâ€™t remember seeing a  
discussion about UnauthorizedAccessException. Just making sure that the  
bug is really being tracked

From:  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
On Behalf Of Thibaut BarrÃ¨re  
Sent: Monday, January 25, 2010 7:21 AM  
To: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 10:23am UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/13 "2010-01-26T10:23:24Z")

</div>

> Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are  
> the default. This, of course, would require elevation (sudo gem install xxx).

I believe per-user gems is now the default (it wasn’t in the past, but  
if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -  
[http://rubyforge.org/forum/forum.php?forum\_id=27728](http://rubyforge.org/forum/forum.php?forum_id=27728) =\> ‘RubyGems now  
installs gems into ~/.gem if GEM\_HOME is not writable. Use  
–no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less  
~$ sudo gem list | grep less  
~$ gem install less  
(…)  
~$ gem list | grep less  
less (1.2.21)  
~$ sudo gem list | grep less  
(empty)

~$ gem -v  
1.3.5  
~$ ruby -v  
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 6:09pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/14 "2010-01-26T18:09:23Z")

</div>

Yes, that occurred to me this morning. 😉

So, runas /user:mymachine\administrator igem install foo for globals  
gems,  
right?

–  
Will G.  
[http://hotgazpacho.org/](http://hotgazpacho.org/)

On Tue, Jan 26, 2010 at 4:16 AM, Thibaut BarrÃ¨re

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 6:10am UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/15 "2010-01-26T06:10:35Z")

</div>

Per-user gems should not be the default. In RubyInstaller (mingw MRI),  
as  
well as MRI on Linux, and I believe OS X, system-wide gems are the  
default.  
This, of course, would require elevation (sudo gem install xxx).

–  
Will G.  
[http://hotgazpacho.org/](http://hotgazpacho.org/)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 6:28pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/16 "2010-01-26T18:28:42Z")

</div>

> I believe per-user gems is now the default  
> That’s right - now if you sudo install a system wide gem, if not, it  
> just creates a .gems in your home dir and installs there. Of course, the  
> local gems are only available to Ruby apps running as that user.

Cheers,  
Sidu.

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 6:21pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/17 "2010-01-26T18:21:41Z")

</div>

There are a couple of differences that would be apparent for this  
proposed solution:

1. 

```
 Runas /userâ€¦. Is much longer than sudo ;)

```

2. 

```
 The normal installation directory is owned by TrustedInstaller 

```

and Admins have no rights by default. We wouldnâ€™t have a supported way  
to share gems at this time, since that does have security risks. Each  
user would have to install their own gems, but (unsupported) you should  
be able to move GEM\_PATH (assuming we can figure out how to share  
between IronRuby and Ruby) to a shared location and change permissions  
on it.

JD

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Will G.  
Sent: Tuesday, January 26, 2010 9:03 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Yes, that occurred to me this morning. 😉

So, runas /user:mymachine\administrator igem install foo for globals  
gems, right?

–  
Will G.

> **[hotgazpacho](http://hotgazpacho.org/)**

On Tue, Jan 26, 2010 at 4:16 AM, Thibaut BarrÃ¨re  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are  
> the default. This, of course, would require elevation (sudo gem install xxx).  
> I believe per-user gems is now the default (it wasn’t in the past, but  
> if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -  
> [http://rubyforge.org/forum/forum.php?forum\_id=27728](http://rubyforge.org/forum/forum.php?forum_id=27728) =\> ‘RubyGems now  
> installs gems into ~/.gem if GEM\_HOME is not writable. Use  
> –no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less  
~$ sudo gem list | grep less  
~$ gem install less  
(…)  
~$ gem list | grep less  
less (1.2.21)  
~$ sudo gem list | grep less  
(empty)

~$ gem -v  
1.3.5  
~$ ruby -v  
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 8:09pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/18 "2010-01-26T20:09:59Z")

</div>

Another way to simulate â€œsudoâ€ is to use an elevated Command Prompt.  
[Run as Administrator | Seven Forums](http://www.sevenforums.com/tutorials/11841-run-administrator.html) tells  
you how. If you are using the command prompt a lot, you only need to  
deal with the UAC dialog box once when you open the elevated Command  
Prompt. After that, all commands executed from the Command Prompt run  
elevated.

Jim, from an elevated Command prompt, I was able to create a new file in  
%ProgramFiles% using notepad, and did not get any UAC dialog box. This  
would mean that â€œgem installâ€ should also be able to install gems to  
%ProgramFiles%. Not sure how this reconciles with your comment about  
TrustedInstaller.

Thibaut, could you try using â€œigem install â€“user-installâ€? (I wonder if  
IronRuby needs to catch the System.UnauthorizedAccessException exception  
and raise a Ruby exception for RubyGems to do the right thing.)

Could you also separately try running from an elevated Command Prompt?

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Jim D.  
Sent: Tuesday, January 26, 2010 9:18 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

There are a couple of differences that would be apparent for this  
proposed solution:

1. 

```
 Runas /userâ€¦. Is much longer than sudo ;)

```

2. 

```
 The normal installation directory is owned by TrustedInstaller 

```

and Admins have no rights by default. We wouldnâ€™t have a supported way  
to share gems at this time, since that does have security risks. Each  
user would have to install their own gems, but (unsupported) you should  
be able to move GEM\_PATH (assuming we can figure out how to share  
between IronRuby and Ruby) to a shared location and change permissions  
on it.

JD

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Will G.  
Sent: Tuesday, January 26, 2010 9:03 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Yes, that occurred to me this morning. 😉

So, runas /user:mymachine\administrator igem install foo for globals  
gems, right?

–  
Will G.

> **[hotgazpacho](http://hotgazpacho.org/)**

On Tue, Jan 26, 2010 at 4:16 AM, Thibaut BarrÃ¨re  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are  
> the default. This, of course, would require elevation (sudo gem install xxx).  
> I believe per-user gems is now the default (it wasn’t in the past, but  
> if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -  
> [http://rubyforge.org/forum/forum.php?forum\_id=27728](http://rubyforge.org/forum/forum.php?forum_id=27728) =\> ‘RubyGems now  
> installs gems into ~/.gem if GEM\_HOME is not writable. Use  
> –no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less  
~$ sudo gem list | grep less  
~$ gem install less  
(…)  
~$ gem list | grep less  
less (1.2.21)  
~$ sudo gem list | grep less  
(empty)

~$ gem -v  
1.3.5  
~$ ruby -v  
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 10:49pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/19 "2010-01-26T22:49:19Z")

</div>

There indeed is a difference in behavior between IronRuby and MRI when  
creating a file in %ProgramFiles% from a non-elevated process. MRI  
silently writes to USERPROFILE. IronRuby raises Errno::EACCES. I have  
opened [http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3685](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3685)  
to track this. I donâ€™t see the System.UnauthorizedAccessException  
though.

D:\>ruby -e “File.open(‘c:/Program Files/foo.txt’, ‘w+’) {}”

D:\>dir “c:\Program Files\foo.txt”  
File Not Found

D:\>dir “%USERPROFILE%\AppData\Local\VirtualStore\Program Files\foo.txt”  
01/26/2010 11:39 AM 0 foo.txt  
1 File(s) 0 bytes  
0 Dir(s) 122,124,869,632 bytes free

D:\>rbx -e “File.open(‘c:/Program Files/foo.txt’, ‘w+’) {}”  
mscorlib:0:in `WinIOError’: Access to the path ‘c:\Program  
Files\foo.txt’ is denied. (Errno::EACCES)

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Tuesday, January 26, 2010 11:09 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Another way to simulate â€œsudoâ€ is to use an elevated Command Prompt.  
[Run as Administrator | Seven Forums](http://www.sevenforums.com/tutorials/11841-run-administrator.html) tells  
you how. If you are using the command prompt a lot, you only need to  
deal with the UAC dialog box once when you open the elevated Command  
Prompt. After that, all commands executed from the Command Prompt run  
elevated.

Jim, from an elevated Command prompt, I was able to create a new file in  
%ProgramFiles% using notepad, and did not get any UAC dialog box. This  
would mean that â€œgem installâ€ should also be able to install gems to  
%ProgramFiles%. Not sure how this reconciles with your comment about  
TrustedInstaller.

Thibaut, could you try using â€œigem install â€“user-installâ€? (I wonder if  
IronRuby needs to catch the System.UnauthorizedAccessException exception  
and raise a Ruby exception for RubyGems to do the right thing.)

Could you also separately try running from an elevated Command Prompt?

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Jim D.  
Sent: Tuesday, January 26, 2010 9:18 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

There are a couple of differences that would be apparent for this  
proposed solution:

1. 

```
 Runas /userâ€¦. Is much longer than sudo ;)

```

2. 

```
 The normal installation directory is owned by TrustedInstaller 

```

and Admins have no rights by default. We wouldnâ€™t have a supported way  
to share gems at this time, since that does have security risks. Each  
user would have to install their own gems, but (unsupported) you should  
be able to move GEM\_PATH (assuming we can figure out how to share  
between IronRuby and Ruby) to a shared location and change permissions  
on it.

JD

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Will G.  
Sent: Tuesday, January 26, 2010 9:03 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Yes, that occurred to me this morning. 😉

So, runas /user:mymachine\administrator igem install foo for globals  
gems, right?

–  
Will G.

> **[hotgazpacho](http://hotgazpacho.org/)**

On Tue, Jan 26, 2010 at 4:16 AM, Thibaut BarrÃ¨re  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are  
> the default. This, of course, would require elevation (sudo gem install xxx).  
> I believe per-user gems is now the default (it wasn’t in the past, but  
> if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -  
> [http://rubyforge.org/forum/forum.php?forum\_id=27728](http://rubyforge.org/forum/forum.php?forum_id=27728) =\> ‘RubyGems now  
> installs gems into ~/.gem if GEM\_HOME is not writable. Use  
> –no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less  
~$ sudo gem list | grep less  
~$ gem install less  
(…)  
~$ gem list | grep less  
less (1.2.21)  
~$ sudo gem list | grep less  
(empty)

~$ gem -v  
1.3.5  
~$ ruby -v  
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [January 26, 2010, 10:54pm UTC](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220/20 "2010-01-26T22:54:02Z")

</div>

Hm, thatâ€™s interestingâ€¦ MRI gets redirected to the virtual store but  
IronRuby does not, I wonder if that is more of a .NET issue than a  
IronRuby problemâ€¦

JD

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Tuesday, January 26, 2010 11:44 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

There indeed is a difference in behavior between IronRuby and MRI when  
creating a file in %ProgramFiles% from a non-elevated process. MRI  
silently writes to USERPROFILE. IronRuby raises Errno::EACCES. I have  
opened [http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3685](http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3685)  
to track this. I donâ€™t see the System.UnauthorizedAccessException  
though.

D:\>ruby -e “File.open(‘c:/Program Files/foo.txt’, ‘w+’) {}”

D:\>dir “c:\Program Files\foo.txt”  
File Not Found

D:\>dir “%USERPROFILE%\AppData\Local\VirtualStore\Program Files\foo.txt”  
01/26/2010 11:39 AM 0 foo.txt  
1 File(s) 0 bytes  
0 Dir(s) 122,124,869,632 bytes free

D:\>rbx -e “File.open(‘c:/Program Files/foo.txt’, ‘w+’) {}”  
mscorlib:0:in `WinIOError’: Access to the path ‘c:\Program  
Files\foo.txt’ is denied. (Errno::EACCES)

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Tuesday, January 26, 2010 11:09 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Another way to simulate â€œsudoâ€ is to use an elevated Command Prompt.  
[Run as Administrator | Seven Forums](http://www.sevenforums.com/tutorials/11841-run-administrator.html) tells  
you how. If you are using the command prompt a lot, you only need to  
deal with the UAC dialog box once when you open the elevated Command  
Prompt. After that, all commands executed from the Command Prompt run  
elevated.

Jim, from an elevated Command prompt, I was able to create a new file in  
%ProgramFiles% using notepad, and did not get any UAC dialog box. This  
would mean that â€œgem installâ€ should also be able to install gems to  
%ProgramFiles%. Not sure how this reconciles with your comment about  
TrustedInstaller.

Thibaut, could you try using â€œigem install â€“user-installâ€? (I wonder if  
IronRuby needs to catch the System.UnauthorizedAccessException exception  
and raise a Ruby exception for RubyGems to do the right thing.)

Could you also separately try running from an elevated Command Prompt?

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Jim D.  
Sent: Tuesday, January 26, 2010 9:18 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

There are a couple of differences that would be apparent for this  
proposed solution:

1. 

```
 Runas /userâ€¦. Is much longer than sudo ;)

```

2. 

```
 The normal installation directory is owned by TrustedInstaller 

```

and Admins have no rights by default. We wouldnâ€™t have a supported way  
to share gems at this time, since that does have security risks. Each  
user would have to install their own gems, but (unsupported) you should  
be able to move GEM\_PATH (assuming we can figure out how to share  
between IronRuby and Ruby) to a shared location and change permissions  
on it.

JD

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Will G.  
Sent: Tuesday, January 26, 2010 9:03 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] “igem install rake” raise an  
System.UnauthorizedAccessException (Windows 7)

Yes, that occurred to me this morning. 😉

So, runas /user:mymachine\administrator igem install foo for globals  
gems, right?

–  
Will G.

> **[hotgazpacho](http://hotgazpacho.org/)**

On Tue, Jan 26, 2010 at 4:16 AM, Thibaut BarrÃ¨re  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are  
> the default. This, of course, would require elevation (sudo gem install xxx).  
> I believe per-user gems is now the default (it wasn’t in the past, but  
> if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -  
> [http://rubyforge.org/forum/forum.php?forum\_id=27728](http://rubyforge.org/forum/forum.php?forum_id=27728) =\> ‘RubyGems now  
> installs gems into ~/.gem if GEM\_HOME is not writable. Use  
> –no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less  
~$ sudo gem list | grep less  
~$ gem install less  
(…)  
~$ gem list | grep less  
less (1.2.21)  
~$ sudo gem list | grep less  
(empty)

~$ gem -v  
1.3.5  
~$ ruby -v  
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

[Next page](https://www.ruby-forum.com/t/igem-install-rake-raise-an-system-unauthorizedaccessexception-windows-7/182220.md?page=2)
