# A newbie question:how to pack it into .exe file

**URL:** <https://www.ruby-forum.com/t/a-newbie-question-how-to-pack-it-into-exe-file/226719>\
**Category:** Ruby-Gnome 2\
**Created:** [February 19, 2013, 12:54pm UTC](https://www.ruby-forum.com/t/a-newbie-question-how-to-pack-it-into-exe-file/226719 "2013-02-19T12:54:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![redknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/da6949/32.png) [@redknight](https://www.ruby-forum.com/u/redknight)\
**Post date:** [February 19, 2013, 12:54pm UTC](https://www.ruby-forum.com/t/a-newbie-question-how-to-pack-it-into-exe-file/226719/1 "2013-02-19T12:54:56Z")

</div>

hello,i am a newbie learner of RB and visualruby

I found it difficult for me to trans a visualruby program(.rb&.glade)  
into a .exe file which could run correctly in win7 .

Now i could only use  
exerb for a simple ruby program(.rb).

would anyone kindly help me about that?

---

<div class="post-metadata">

**Author:** ![redknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/da6949/32.png) [@redknight](https://www.ruby-forum.com/u/redknight)\
**Post date:** [February 20, 2013, 5:37am UTC](https://www.ruby-forum.com/t/a-newbie-question-how-to-pack-it-into-exe-file/226719/2 "2013-02-20T05:37:29Z")

</div>

Hi:

The way to distribute programs is to package them as rubygems. You need  
to make an executable file in the rubygem, and when the gem is  
installed, the user can run the program by typing the filename at the  
command prompt. For example, the visualruby program has a file named  
“vr” that installs in the gem directory. So when a user types “vr” at  
the command prompt, visualruby runs.

In visualruby, create a gemspec file, and make an executable file. For  
more info:

[rubygems.org](http://rubygems.org)

has documentation.

The gemspecs are a bit confusing because everything is allowed to have a  
different name (the program, the executable, the project and the gem).  
Try using the visualruby examples to learn.

Good luck,  
Eric

---

<div class="post-metadata">

**Author:** ![redknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/da6949/32.png) [@redknight](https://www.ruby-forum.com/u/redknight)\
**Post date:** [February 20, 2013, 1:10pm UTC](https://www.ruby-forum.com/t/a-newbie-question-how-to-pack-it-into-exe-file/226719/3 "2013-02-20T13:10:04Z")

</div>

Eric C. wrote in post #1097900:

> Hi:
> 
> The way to distribute programs is to package them as rubygems. You need  
> to make an executable file in the rubygem, and when the gem is  
> installed, the user can run the program by typing the filename at the  
> command prompt. For example, the visualruby program has a file named  
> “vr” that installs in the gem directory. So when a user types “vr” at  
> the command prompt, visualruby runs.
> 
> In visualruby, create a gemspec file, and make an executable file. For  
> more info:
> 
> [rubygems.org](http://rubygems.org)
> 
> has documentation.
> 
> The gemspecs are a bit confusing because everything is allowed to have a  
> different name (the program, the executable, the project and the gem).  
> Try using the visualruby examples to learn.
> 
> Good luck,  
> Eric

hello,Eric,thank you for your kind answer.  
But I am afraid that you may misunderstand what i meant.  
To make the question clear:  
Could somebody use my vr-program without installing ruby?How?  
BTW:  
I got another quention:When I run the vr-program(by “ruby main.rb”),I  
got a really big cmd-window.  
How can I get rid of it?

Thanks again for your help! 😉

---

<div class="post-metadata">

**Author:** ![redknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/da6949/32.png) [@redknight](https://www.ruby-forum.com/u/redknight)\
**Post date:** [February 20, 2013, 5:51pm UTC](https://www.ruby-forum.com/t/a-newbie-question-how-to-pack-it-into-exe-file/226719/4 "2013-02-20T17:51:19Z")

</div>

Vincent C. wrote in post #1097983:

> No.  
> But in theory you can package your program and your dependencies  
> including  
> ruby in one big windows installation file.  
> See [http://rubyscript2exe.rubyforge.org/](http://rubyscript2exe.rubyforge.org/) for example.

Thanks!it helps me a lot

I got another question:  
When I run the vr-program(not by “ruby main.rb” but by double-click),I  
got a cmd-window behind my gui.

How can I get rid of it?

---

<div class="post-metadata">

**Author:** ![redknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/da6949/32.png) [@redknight](https://www.ruby-forum.com/u/redknight)\
**Post date:** [February 20, 2013, 9:17pm UTC](https://www.ruby-forum.com/t/a-newbie-question-how-to-pack-it-into-exe-file/226719/5 "2013-02-20T21:17:11Z")

</div>

> > ruby in one big windows installation file.

On windows, Ocra do all : ruby executable embeded, gem too.  
But i think that Gtk/glade must be installed by thinks  
like [http://sourceforge.net/projects/gtk-win/files/](http://sourceforge.net/projects/gtk-win/files/)

> When I run the vr-program(not by “ruby main.rb” but by double-click),I  
> got a cmd-window behind my gui.

Rubyw.exe run ruby without console.  
for running rubyw on click, rename main.rb by main.rbw

or you can use hstart :

> hstart /noconsole “ruby main.rb”

---

<div class="post-metadata">

**Author:** ![redknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/da6949/32.png) [@redknight](https://www.ruby-forum.com/u/redknight)\
**Post date:** [February 21, 2013, 11:20am UTC](https://www.ruby-forum.com/t/a-newbie-question-how-to-pack-it-into-exe-file/226719/6 "2013-02-21T11:20:12Z")

</div>

Regis d’Aubarede wrote in post #1098049:

> > > ruby in one big windows installation file.
> 
> On windows, Ocra do all : ruby executable embeded, gem too.  
> But i think that Gtk/glade must be installed by thinks  
> like [http://sourceforge.net/projects/gtk-win/files/](http://sourceforge.net/projects/gtk-win/files/)
> 
> > When I run the vr-program(not by “ruby main.rb” but by double-click),I  
> > got a cmd-window behind my gui.
> 
> Rubyw.exe run ruby without console.  
> for running rubyw on click, rename main.rb by main.rbw
> 
> or you can use hstart :
> 
> > hstart /noconsole “ruby main.rb”

Thank you!  
It works.  
;-D

---

<div class="post-metadata">

**Author:** ![redknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/da6949/32.png) [@redknight](https://www.ruby-forum.com/u/redknight)\
**Post date:** [February 20, 2013, 4:21pm UTC](https://www.ruby-forum.com/t/a-newbie-question-how-to-pack-it-into-exe-file/226719/7 "2013-02-20T16:21:23Z")

</div>

Hi.

> hello,Eric,thank you for your kind answer.  
> But I am afraid that you may misunderstand what i meant.  
> To make the question clear:  
> Could somebody use my vr-program without installing ruby?How?

No.  
But in theory you can package your program and your dependencies  
including  
ruby in one big windows installation file.  
See [http://rubyscript2exe.rubyforge.org/](http://rubyscript2exe.rubyforge.org/) for example.
