# Stripping down One-Click Ruby Installer folder for deployment

**URL:** <https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924>\
**Category:** Ruby\
**Created:** [October 22, 2007, 2:36pm UTC](https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924 "2007-10-22T14:36:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 22, 2007, 2:36pm UTC](https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924/1 "2007-10-22T14:36:40Z")

</div>

Hi,

I’d like to deploy an client ruby application by copying the “c:\ruby”  
folder to the target computers.

It works fine, except that c:\ruby is 177 MB big, and full of things  
that are not necessary at all on client computers.

I have tried keeping the following folders:

- “c:\ruby.”
- “c:\ruby\bin”
- “c:\ruby\lib”

It works, but I’d like to know if anyone has a more “scientific”  
approach to that problem. What folders are absolutely needed?

Note that I know about rubyscript2exe.rb; it works just fine for small  
applications, but it’s not an option in this case.

Thanks!

Philippe

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 22, 2007, 7:50pm UTC](https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924/2 "2007-10-22T19:50:53Z")

</div>

On Oct 22, 9:35 am, “Philippe L.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> - “c:\ruby.”
> 
> Philippe

Phillipe, most of the used space is wasted on documentation (in the  
form of yaml for RI and .html for Rdoc).

Those are located in lib\ruby\gems\1.8\doc and the share\ri  
\1.8\system

Also, try removing gems that you don’t need for it.

I know, isn’t “scientific” nor bulletproof, but will work 🙂

HTH,

Luis

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 23, 2007, 2:30pm UTC](https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924/3 "2007-10-23T14:30:59Z")

</div>

Luis L. wrote:

> > I have tried keeping the following folders:
> 
> Also, try removing gems that you don’t need for it.
> 
> I know, isn’t “scientific” nor bulletproof, but will work 🙂

I’ve asked for just a “core Ruby” distro in the past (i.e. no stdlib  
even), but Matz was less than enthusiastic about it.

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 23, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924/4 "2007-10-23T19:35:31Z")

</div>

On Oct 23, 10:55 am, “Philippe L.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > small applications, but it’s not an option in this case.
> 
> ## FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\doc’)
> 
> If anyone is able to strip down the c:\ruby directory for deployment  
> even more, your help is welcome!

Yeah, it’s possible.

The thing is that Ruby (and One-Click) ship with a lot of things that  
you rarely will use (or you aren’t aware they are present).

Part of the idea for next releases of One-Click cover this topic, but  
still no plan on how that will be achieved. One of things will be  
Installer merge modules (MSM) to modularize the whole installer.

I’m collecting a few questions for a survey [1] to focus on what users  
want/need for the next release. Please jump in to rubyinstaller-  
removed\_email\_address@domain.invalid and provide feedback of what you will love it to  
have (or better/more questions for the survey).

Regards,

[1]  
[http://rubyforge.org/pipermail/rubyinstaller-devel/2007-October/000202.html](http://rubyforge.org/pipermail/rubyinstaller-devel/2007-October/000202.html)

Luis

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 23, 2007, 9:54pm UTC](https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924/5 "2007-10-23T21:54:27Z")

</div>

On 10/23/07, Philippe L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ## FileUtils.rm\_rf($NEW\_PATH) FileUtils.mkdir($NEW\_PATH) FileUtils.cp\_r($OLD\_PATH + ‘\bin’, $NEW\_PATH + ‘\bin’) FileUtils.cp\_r($OLD\_PATH + ‘\lib’, $NEW\_PATH + ‘\lib’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\doc’)
> 
> If anyone is able to strip down the c:\ruby directory for deployment  
> even more, your help is welcome!

You may try (but not I am not sure if this will work, I _guess_ it  
will be regenerated on demand):

FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\cache’)  
FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\source\_cache’)

If you don’t plan on compiling extensions, you may remove \*.lib

Download spacemonger to see what are the largest files/dirs.

You may strip more stuff, depending on what do you need - there’s a  
lot of stuff for TK for example, just make sure your stuff still runs  
😉

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 23, 2007, 10:30pm UTC](https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924/6 "2007-10-23T22:30:47Z")

</div>

On Oct 23, 4:53 pm, “Jano S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > $OLD\_PATH = ‘c:\ruby’
> 
> Download spacemonger to see what are the largest files/dirs.
> 
> You may strip more stuff, depending on what do you need - there’s a  
> lot of stuff for TK for example, just make sure your stuff still runs  
> 😉

The other, more complex, will involve use of something like Exerb [1]  
to trace what files your application use.

(inside Exerb there is a tool called mkexy)

This will generate a .exy file containing which file and paths (and  
extensions) are required by your application.

You just need to add later the ruby.exe, rubyw.exe (if you are  
developing GUI applications) and of course msvcrt-libruby18.dll

Try to recreate the folder structure listed in the .exy and just put  
there the files indicated.

Use this carefully, I haven’t tested enough to confirm work in all  
cases.

Regards,

Luis

[1] [Exerb Project](http://exerb.sourceforge.jp/index.en.html)

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 23, 2007, 3:55pm UTC](https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924/7 "2007-10-23T15:55:55Z")

</div>

Luis L. wrote:

> > I have tried keeping the following folders:
> 
> Also, try removing gems that you don’t need for it.
> 
> I know, isn’t “scientific” nor bulletproof, but will work 🙂

Hi Luis,

This is the script I use. It strips down the c:\ruby directory from 179  
MB to 51 MB on my computer, and apparently, everything works. It is  
still very big, but acceptable, especially when compressed in RAR: 14.3  
MB.

* * *

$OLD\_PATH = ‘c:\ruby’  
$NEW\_PATH = ‘c:\ruby\_stripped’

require ‘fileutils’

## FileUtils.rm\_rf($NEW\_PATH) FileUtils.mkdir($NEW\_PATH) FileUtils.cp\_r($OLD\_PATH + ‘\bin’, $NEW\_PATH + ‘\bin’) FileUtils.cp\_r($OLD\_PATH + ‘\lib’, $NEW\_PATH + ‘\lib’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\doc’)

If anyone is able to strip down the c:\ruby directory for deployment  
even more, your help is welcome!

Regards,

Philippe

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 24, 2007, 9:52am UTC](https://www.ruby-forum.com/t/stripping-down-one-click-ruby-installer-folder-for-deployment/117924/8 "2007-10-24T09:52:10Z")

</div>

Jano S. wrote:

> > 
> 
> You may try (but not I am not sure if this will work, I _guess_ it  
> You may strip more stuff, depending on what do you need - there’s a  
> lot of stuff for TK for example, just make sure your stuff still runs  
> 😉

Hi Jano,

Thanks, I was able to strip the ruby directory even further, with your  
help and the following script:

* * *

$OLD\_PATH = ‘c:\ruby’  
$NEW\_PATH = ‘c:\ruby\_stripped’

require ‘fileutils’

## FileUtils.rm\_rf($NEW\_PATH) FileUtils.mkdir($NEW\_PATH) FileUtils.cp\_r($OLD\_PATH + ‘\bin’, $NEW\_PATH + ‘\bin’) FileUtils.cp\_r($OLD\_PATH + ‘\lib’, $NEW\_PATH + ‘\lib’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\doc’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\cache’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\source\_cache’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\msvcrt-ruby18-static.lib’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\msvcrt-ruby18.lib’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\doc’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\rdoc-sources’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\examples’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\tests’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3’) FileUtils.rm\_rf($NEW\_PATH + ‘\lib\ruby\gems\1.8\gems\hpricot-0.6-mswin32’)

Deleting “cache” and “source\_cache” did not harm the system, apparently.

Now, compressed with 7-ZIP, the whole directry is 5.2MB big, which is  
more than acceptable for deployement.

I still have to try “Exerb” when I have more time.

Regards,

Philippe
