# How to reduce size of .exe file got from ocra

**URL:** <https://www.ruby-forum.com/t/how-to-reduce-size-of-exe-file-got-from-ocra/198851>\
**Category:** wxRuby\
**Created:** [November 9, 2010, 9:08am UTC](https://www.ruby-forum.com/t/how-to-reduce-size-of-exe-file-got-from-ocra/198851 "2010-11-09T09:08:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [November 9, 2010, 9:08am UTC](https://www.ruby-forum.com/t/how-to-reduce-size-of-exe-file-got-from-ocra/198851/1 "2010-11-09T09:08:45Z")

</div>

Hi,

I just create a simple WxRuby app and then try to turn it into .exe file  
using Ocra. The code is something like…

require ‘wx’

class SimpleApp \< Wx:App  
def on\_init  
Wx::Frame.new(nil, -1, “Simple App”).show()  
end  
end

SimpleApp.new.main\_loop

However, the exe file from Ocra is quite big, about 5.45 Mb. I think it  
is because Wx requires many dependencies so that make this result.  
BTW, Is there any way to reduce file size of this exe ?

Wut

---

<div class="post-metadata">

**Author:** ![wut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ecccb3/32.png) [@wut](https://www.ruby-forum.com/u/wut)\
**Post date:** [November 9, 2010, 2:35pm UTC](https://www.ruby-forum.com/t/how-to-reduce-size-of-exe-file-got-from-ocra/198851/2 "2010-11-09T14:35:27Z")

</div>

On Tue, Nov 9, 2010 at 4:08 PM, Worrawut Poonsuk  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> end

There should be some freeware out there  
to reduce exe file size,  
I found two long time ago, but forgot their name

---

<div class="post-metadata">

**Author:** ![wut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ecccb3/32.png) [@wut](https://www.ruby-forum.com/u/wut)\
**Post date:** [November 11, 2010, 2:13pm UTC](https://www.ruby-forum.com/t/how-to-reduce-size-of-exe-file-got-from-ocra/198851/3 "2010-11-11T14:13:31Z")

</div>

Wut 'sup?

I don’t think so, since the ‘require ‘wx’’ line loads all of WxRuby. I  
think you’ll find that if you write a very elaborate ruby code, along  
the lines of 300KB in size, the .exe will not change much.

But if I’m proved otherwise, by all means ignore me.

- hameed

---

<div class="post-metadata">

**Author:** ![wut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ecccb3/32.png) [@wut](https://www.ruby-forum.com/u/wut)\
**Post date:** [November 12, 2010, 5:26am UTC](https://www.ruby-forum.com/t/how-to-reduce-size-of-exe-file-got-from-ocra/198851/4 "2010-11-12T05:26:11Z")

</div>

when I do \>ocra very\_simple\_app.rb, then ocra compile and the trace  
looks something like…

…  
…  
a  
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/treectrl/icon4.xpm  
a  
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/treectrl/icon5.xpm  
a  
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/treectrl/treectrl.r  
b  
m lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/xrc  
a  
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/xrc/samples.xrc  
a  
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/xrc/xrc\_sample.rb  
e RUBYOPT -rubygems  
e RUBYLIB  
e GEM\_PATH \gemhome  
p \bin\ruby.exe ruby.exe “\src\very\_simple\_app.rb”  
=== Compressing  
=== Finished building very\_simple\_app.exe (5720630 bytes)

I think I don’t need to load such dependencies like /samples, etc…  
I look into ocra document again and found that ocra will load all  
dependencies describe in manifest file of the required gem(or source  
file). So that I should be able to reduce size by modify the manifest of  
my wxruby.

But the problem is, I cannot find the manifest file in the  
/lib/ruby/gem/1.8/gems/wxruby-2.0.1-x86-mswin32-60/, cann’t find it from  
the root of ruby path as well 😛

How can I address ?  
Any suggestion, pls?

Wut

---

<div class="post-metadata">

**Author:** ![wut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ecccb3/32.png) [@wut](https://www.ruby-forum.com/u/wut)\
**Post date:** [November 12, 2010, 11:48am UTC](https://www.ruby-forum.com/t/how-to-reduce-size-of-exe-file-got-from-ocra/198851/5 "2010-11-12T11:48:15Z")

</div>

what about move your samples directory somewhere and try again?  
perhaps that would do the trick?

---

<div class="post-metadata">

**Author:** ![wut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ecccb3/32.png) [@wut](https://www.ruby-forum.com/u/wut)\
**Post date:** [November 11, 2010, 6:19pm UTC](https://www.ruby-forum.com/t/how-to-reduce-size-of-exe-file-got-from-ocra/198851/6 "2010-11-11T18:19:29Z")

</div>

I believe the exe will be much more than 300 KB in size,  
since exe files include all library  
it need, and Wx is not a very small one.  
about 5 mb is normal

I have used ruby script2exe before and the result is way bigger than 5  
mb  
so yours is fine, really
