# Installing Ruby and Ruby Gems in a USB Flash Stick

**URL:** <https://www.ruby-forum.com/t/installing-ruby-and-ruby-gems-in-a-usb-flash-stick/163363>\
**Category:** Ruby\
**Created:** [March 19, 2009, 4:00pm UTC](https://www.ruby-forum.com/t/installing-ruby-and-ruby-gems-in-a-usb-flash-stick/163363 "2009-03-19T16:00:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rubina](https://www.ruby-forum.com/u/rubina)\
**Post date:** [March 19, 2009, 4:00pm UTC](https://www.ruby-forum.com/t/installing-ruby-and-ruby-gems-in-a-usb-flash-stick/163363/1 "2009-03-19T16:00:01Z")

</div>

Hello team,

Had anyone installed Ruby in a USB Flash Stick?  
I installed 1.9.1 using the vxRuby installer, which installs ruby and  
wxruby, in my 64GB USB memory stick.  
This created the following issues:

1. When I run it from a machine that already has ruby installed, I  
don’t  
know from where ruby is running.
2. When I try to install any gem, it actuall go to the C-Drive  
instead of  
my USB stick. I noticed that you can tell gem where to install gems,  
but it  
is not clear to me.

F:\>gem help install  
Usage: gem install GEMNAME [GEMNAME …] [options] – --build-flags  
[options]  
Options:  
-i, --install-dir DIR Gem repository directory to get  
installed gems  
-n, --bindir DIR Directory where binary files are  
located

For example, since in my case for this period of time my USB is drive F,  
I  
thought that this would work, and it does…kind of:

\*F:\>gem install ezcrypto -i F:\ruby\lib\ruby\gems\1.9.1\gems  
\*Successfully installed ezcrypto-0.7.2  
1 gem installed  
Installing ri documentation for ezcrypto-0.7.2…  
Installing RDoc documentation for ezcrypto-0.7.2…  
_ERROR: While executing gem … (TypeError)  
can’t convert Pathname into String_

This installs the gem but in the folder specified, but it does not  
creates a  
dir for the gem. It puts all the files in  
\*F:\ruby\lib\ruby\gems\1.9.1\gems.  
\*  
I was expecting something like:  
_F:\ruby\lib\ruby\gems\1.9.1\gems\ezcrypto_

The other problem that you can see is installing the documentation. This  
appears to be a known bug because it is happening on every machine where  
I  
installed 1.9.1. For now I am not too worry about it.

Comments from anyone will be appreciated.

Thank you

---

<div class="post-metadata">

**Author:** ![rubina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rubina](https://www.ruby-forum.com/u/rubina)\
**Post date:** [March 20, 2009, 4:15pm UTC](https://www.ruby-forum.com/t/installing-ruby-and-ruby-gems-in-a-usb-flash-stick/163363/2 "2009-03-20T16:15:38Z")

</div>

Ruby S. wrote:

> Had anyone installed Ruby in a USB Flash Stick?

…

> 1. When I run it from a machine that already has ruby installed, I don’t  
> know from where ruby is running.
> 2. When I try to install any gem, it actuall go to the C-Drive instead of  
> my USB stick. I noticed that you can tell gem where to install gems, but it  
> is not clear to me.

You should look into setting a PATH environment variable to tell the  
system you’re working on to look for the ‘ruby’ and ‘gem’ executables on  
the USB stick, rather than on C:/ etc. Have a look at:

[http://www.google.co.uk/search?q=path+environment](http://www.google.co.uk/search?q=path+environment)

alex

---

<div class="post-metadata">

**Author:** ![rubina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rubina](https://www.ruby-forum.com/u/rubina)\
**Post date:** [March 20, 2009, 4:26pm UTC](https://www.ruby-forum.com/t/installing-ruby-and-ruby-gems-in-a-usb-flash-stick/163363/3 "2009-03-20T16:26:11Z")

</div>

On Fri, Mar 20, 2009 at 11:12 AM, Alex F.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> > 1. When I try to install any gem, it actuall go to the C-Drive instead  
> > [path environment - Google Search](http://www.google.co.uk/search?q=path+environment)
> 
> alex

Thanks Alex!
