gem file in Windows HOME directory

15 views
Skip to first unread message

Mohit Sindhwani

unread,
Jun 26, 2021, 11:22:22 AMJun 26
to RubyInstaller
Hi! I have a bit of a problem and I am trying to figure out some details
and can use some help.

Background
* In JRuby, you are expected to do:
jruby - S gem list
and whenever I do that, I get no output.
If I do jruby -S jgem list
it works fine.

After fiddling around, I found that when I do 'where gem' I get this:
C:\Users\mohit>where gem
C:\Users\mohit\gem
C:\jruby-9.2.18.0\bin\gem
C:\jruby-9.2.18.0\bin\gem.bat

So, it finds a file called gem (0 bytes) in Windows HOME directory and
loads that and fails.
I realised the basic problem that I am in the HOME directory (!) when I
do this, so it obviously finds the 'gem' file there.

So, the question is simply this:
* do you know what creates the gem file there and the folder .gem under
it with a bunch of stuff. Is it Ruby (2.2 or 2.6 or 3.0) or is it JRuby?
* does it matter if I rename the file there or delete it? What is it
used for?

The alternative is that something should change in jruby when it does -S.

Any inputs appreciated.

Best Regards,
Mohit.


Lars Kanis

unread,
Jun 26, 2021, 12:23:02 PMJun 26
to rubyin...@googlegroups.com
Hi Mohit,

yes the current directory is always first in the search path for
executables on WIndows. That can be surprising if you use to work on a
Linux or Macos machine.

You should simply delete C:\Users\mohit\gem . It's probably left from
some mistyping on the command line or so. I don't know of any ruby
component that creates this file in the home directory. If the file is
deleted a simple "gem list" should work and should list the installed
gems of the Ruby version that is first in the PATH.

In contrast the ".gem" directory and ".gemrc" are configuration files
that store persistent information of rubygems. This can be rubygems.org
credentials, gem sources, signature keys and the like.

Regards,
Lars

Mohit Sindhwani

unread,
Jun 26, 2021, 12:28:40 PMJun 26
to rubyin...@googlegroups.com, Lars Kanis
Thanks Lars!

On 2021-6-27 12:21 am, Lars Kanis wrote:
> Hi Mohit,
>
> yes the current directory is always first in the search path for
> executables on WIndows. That can be surprising if you use to work on a
> Linux or Macos machine.

Yes, I'm aware of this since I'm basically a Windows user... the
stupidity on my part was to realise that I was in the HOME directory
much too late - so, after that, it was obvious what was happening.

> You should simply delete C:\Users\mohit\gem . It's probably left from
> some mistyping on the command line or so. I don't know of any ruby
> component that creates this file in the home directory. If the file is
> deleted a simple "gem list" should work and should list the installed
> gems of the Ruby version that is first in the PATH.

thanks! Just wanted some confirmation if this was intended. The rest is
OK, I already know it works since I have renamed it and tried running
stuff - and all looks normal. I will rename it for now permanently
before deleting it in a few weeks.

I have 0 byte gem, pik and java files in the folder.. and it's likely
that these showed up by mistake.

> In contrast the ".gem" directory and ".gemrc" are configuration files
> that store persistent information of rubygems. This can be rubygems.org
> credentials, gem sources, signature keys and the like.

Yes, I have a .gem folder there with the stuff as you mentioned.

Thanks for the confirmation. I will now watch the next time I do an
installation to see if this recurs and report back if that's the case.

Best Regards,
Mohit.


Reply all
Reply to author
Forward
0 new messages