# Trouble using rubygems config file on windows

**URL:** <https://www.ruby-forum.com/t/trouble-using-rubygems-config-file-on-windows/78803>\
**Category:** Ruby\
**Created:** [December 8, 2006, 7:11pm UTC](https://www.ruby-forum.com/t/trouble-using-rubygems-config-file-on-windows/78803 "2006-12-08T19:11:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 8, 2006, 7:11pm UTC](https://www.ruby-forum.com/t/trouble-using-rubygems-config-file-on-windows/78803/1 "2006-12-08T19:11:40Z")

</div>

Hey All,

I’m trying to get rubygems to use my .gemrc file on windows and having  
trouble–dig it:

C:\ruby\bin\>gem environment  
Failed to load C:\Documents and Settings\pardre1/.gemrc  
Rubygems Environment:

- VERSION: 0.9.0 (0.9.0)
- INSTALLATION DIRECTORY: C:/ruby/lib/ruby/gems/1.8
- GEM PATH:
  - C:/ruby/lib/ruby/gems/1.8

- REMOTE SOURCES:
  - [http://gems.rubyforge.org](http://gems.rubyforge.org)

The file listed does indeed exist–I’m guessing there needs to be a  
.gsub(/\/, “/”) in there somewhere to translate the backslashes to  
forwardslashes on windows?

Thanks!

-Roy

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 8, 2006, 7:21pm UTC](https://www.ruby-forum.com/t/trouble-using-rubygems-config-file-on-windows/78803/2 "2006-12-08T19:21:43Z")

</div>

removed\_email\_address@domain.invalid wrote:

> Hey All,
> 
> I’m trying to get rubygems to use my .gemrc file on windows and having  
> trouble–dig it:
> 
> C:\ruby\bin\>gem environment  
> Failed to load C:\Documents and Settings\pardre1/.gemrc

See this line? Try changing the forward slash at the right to a  
reverse-slash.

/ …

> The file listed does indeed exist–I’m guessing there needs to be a  
> .gsub(/\/, “/”) in there somewhere to translate the backslashes to  
> forwardslashes on windows?

Hard to say. But be consistent – all forward, or all backward, but not  
mixed as they are now.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 8, 2006, 7:47pm UTC](https://www.ruby-forum.com/t/trouble-using-rubygems-config-file-on-windows/78803/3 "2006-12-08T19:47:47Z")

</div>

Sure–I get that they all have to be forward slashes. But it’s  
rubygems–not code I’ve written, so I’m not sure exactly where to make  
the change.

That said–I did try changing line 380 of  
C:\ruby\lib\ruby\site\_ruby\1.8\rubygems.rb to:

return ENV[homekey].gsub(/\/, “/”) if ENV[homekey]

And now I get the same error message, except that the filespec looks  
righteous:

C:\ruby\bin\>gem environment  
Failed to load C:/Documents and Settings/pardre1/.gemrc  
Rubygems Environment:

- VERSION: 0.9.0 (0.9.0)
- INSTALLATION DIRECTORY: C:/ruby/lib/ruby/gems/1.8
- GEM PATH:
  - C:/ruby/lib/ruby/gems/1.8

- REMOTE SOURCES:
  - [http://gems.rubyforge.org](http://gems.rubyforge.org)

In irb, I can do e.g.,:

irb(main):001:0\> f = File.open(“C:/Documents and  
Settings/pardre1/.gemrc”)  
=\> #\<File:C:/Documents and Settings/pardre1/.gemrc\>  
irb(main):002:0\> f.read  
=\> “–http-proxy [http://localhost:5865](http://localhost:5865)”  
irb(main):003:0\>

So maybe the problem is that my file is not interpretable as YAML? If  
so–can anybody tell me how to say “use the proxy server  
[http://localhost:5865](http://localhost:5865)” in YAML?

Thanks!

-Roy
