# RubyScript2Exe

**URL:** <https://www.ruby-forum.com/t/rubyscript2exe/164563>\
**Category:** Ruby\
**Created:** [April 2, 2009, 4:50pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563 "2009-04-02T16:50:04Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 2, 2009, 4:50pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/1 "2009-04-02T16:50:04Z")

</div>

Hi,

I am a complete novice to ruby, so please feel free to ask for more  
information so this post makes more sense.

I am trying to create an exe from the ruby script, and it all seems to  
go well but the resulting exe doesn’t do what it’s supposed to. Well it  
doesn’t do anything at all in fact!

I am creating the exe from the ruby script at:

```
http://po-ru.com/files/iplayer-dl-latest.tar.gz

```

I’ve created 2 folders:

1. C:\Test:\rubyscript2exe

2. C:\Test\iplayer-dl-0.1.15

3. Contains all the rubyscript2exe files and the ev directory.

4. Contains the files and folders from the above link.

I then run the following line in my command prompt (Win XP)

ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”  
“C:\Test\iplayer-dl-0.1.15\lib\iplayer.rb”

It starts to looks good with the following output:  
Tracing iplayer …  
Gathering files …  
Copying files …  
Creating iplayer.exe

However if I try to execute iplayer.exe nothing happens in the console.  
I just get the console prompt after a short pause.  
I am expecting to receive a whole load of relevant help information  
about iplayer.exe

I’ve managed to get this to work before but for some reason I can’t get  
the exe working anymore. Is there something dumb that I’m doing?

Charlie

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 10:30am UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/2 "2009-04-03T10:30:31Z")

</div>

Hello Charlie,

> However if I try to execute iplayer.exe nothing happens in the console.  
> I just get the console prompt after a short pause.

Maybe, the console prompt shows the right messages for, say, some  
milli-seconds and then imediately disappears?  
To avoid this, you can do:

Invoke a persisten Console Window (in German Windows it is: Start \>  
Ausfuehren \> type “cmd” )  
In the console window run your iplayer.exe; maybe you have to use the  
full path.

Axel

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 10:36am UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/3 "2009-04-03T10:36:10Z")

</div>

Axel,

Thanks for you post but I am already using the Command Prompt (Start \>  
Run \> cmd)  
☹

Charlie

unknown wrote:

> Hello Charlie,
> 
> > However if I try to execute iplayer.exe nothing happens in the console.  
> > I just get the console prompt after a short pause.
> 
> Maybe, the console prompt shows the right messages for, say, some  
> milli-seconds and then imediately disappears?  
> To avoid this, you can do:
> 
> Invoke a persisten Console Window (in German Windows it is: Start \>  
> Ausfuehren \> type “cmd” )  
> In the console window run your iplayer.exe; maybe you have to use the  
> full path.
> 
> Axel

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 10:42am UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/4 "2009-04-03T10:42:14Z")

</div>

On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> I am a complete novice to ruby, so please feel free to ask for more  
> information so this post makes more sense.
> 
> I am trying to create an exe from the ruby script, and it all seems to  
> go well but the resulting exe doesn’t do what it’s supposed to. Well it  
> doesn’t do anything at all in fact!

I had a quick look at rubyscript2exe yesterday. It’s not currently  
maintained and is not compatible with current versions of Ruby (throws  
exceptions with 1.8.6p287). I would not recommend it for use in its  
current state.

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 4:48pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/5 "2009-04-03T16:48:09Z")

</div>

Lars C. wrote:

> On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi,
> > 
> > I am a complete novice to ruby, so please feel free to ask for more  
> > information so this post makes more sense.
> > 
> > I am trying to create an exe from the ruby script, and it all seems to  
> > go well but the resulting exe doesn’t do what it’s supposed to. ï¿½Well it  
> > doesn’t do anything at all in fact!
> 
> I had a quick look at rubyscript2exe yesterday. It’s not currently  
> maintained and is not compatible with current versions of Ruby (throws  
> exceptions with 1.8.6p287). I would not recommend it for use in its  
> current state.

Nah, rubyscript2exe.rb works like a charm. I assume you are talking  
about the frozen string exception which is a trivial fix (below).

I understand your concern that it has not been updated for a while, but  
on the other hand it doesn’t need any updating apart from this one-liner  
fix. It is not uncommon for someone to write a sweet tool and then fall  
off the Earth for a time. You can help by writing the author  
[rubyscript2exe at erikveen dot dds dot nl], or if you live in  
Netherlands knock on his door and say, “Yo, change that line!” in Dutch.

— rubyscript2exe.rb.orig 2009-04-03 10:28:41.140806000 -0400  
+++ rubyscript2exe.rb 2009-04-03 10:29:40.108423800 -0400  
@@ -618,7 +618,7 @@

newlocation do  
if **FILE** == $0

- 

```
 $0.replace(File.expand_path("./init.rb"))

```

- 

```
 $0 = File.expand_path("./init.rb")

 TAR2RUBYSCRIPT = true unless defined?(TAR2RUBYSCRIPT)

```

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 3:22pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/6 "2009-04-03T15:22:06Z")

</div>

Lars,

Thanks for taking the time to help me.

As I mentioned in my original post I’ve managed to get this to work  
before but for some reason I can’t get the exe working anymore.

It says it’s supported up to version 1.8, and I’ve got 1.8.26, so would  
it be best to just install version 1.8 of Ruby?

Charlie

Lars C. wrote:

> On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi,
> > 
> > I am a complete novice to ruby, so please feel free to ask for more  
> > information so this post makes more sense.
> > 
> > I am trying to create an exe from the ruby script, and it all seems to  
> > go well but the resulting exe doesn’t do what it’s supposed to. ï¿½Well it  
> > doesn’t do anything at all in fact!
> 
> I had a quick look at rubyscript2exe yesterday. It’s not currently  
> maintained and is not compatible with current versions of Ruby (throws  
> exceptions with 1.8.6p287). I would not recommend it for use in its  
> current state.

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/7 "2009-04-03T16:55:04Z")

</div>

I’ve been using rubyscript2exe with 1.8.7 without any problems.

I’ve tested it in Vista + XP … It uses an “eee” wrapper for the  
executable  
… You’ll find that when you run an exe compiled by rubyscript2exe, it  
extracts all of the files into:

\Documents and Settings\<username\>\eee\

There is an option to just extract the files from Rubyscript2exe and not  
run  
the .RB, I would extract the files, and make sure your application runs  
via  
“ruby scriptname.rb” in the directory that it extracts to.

The argument to pass to your compiled exe is --eee-just-extract.

On Fri, Apr 3, 2009 at 9:21 AM, Charlie Openshaw \<

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 6:15pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/8 "2009-04-03T18:15:52Z")

</div>

Brian,

That’s really interesting Brian because I’m not getting anything in

C:\Documents and Settings\<username\>\eee\

When I run the exe I actually get a file created, but it then  
disappears!

Brian W. wrote:

> There is an option to just extract the files from Rubyscript2exe and not  
> run  
> the .RB, I would extract the files, and make sure your application runs  
> via  
> “ruby scriptname.rb” in the directory that it extracts to.
> 
> The argument to pass to your compiled exe is --eee-just-extract.

I’m really sorry I’m not sure what you mean. Is this an option for  
creating the exe or running the exe?

Charlie

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 5:33pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/9 "2009-04-03T17:33:19Z")

</div>

Higgs Bozo,

Thanks for your post, it’s good to know that there’s an update.

I applied the change you suggested but with no luck, I get the same  
behaviour (it says it’s created the new exe, but the exe doesn’t do  
anything when it runs).

Charlie

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 6:36pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/10 "2009-04-03T18:36:25Z")

</div>

On Fri, Apr 3, 2009 at 4:47 PM, The Higgs bozo [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Lars C. wrote:
> 
> > On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw  
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> Nah, rubyscript2exe.rb works like a charm. I assume you are talking  
> about the frozen string exception which is a trivial fix (below).

Sorry, it does work with your fix, but still not via the gem. I need  
to invoke realstuff.rb directly.

The $0 mangling is not working with paths on my setup:

This script:

a =  
“C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/realstuff.rb”  
$0 = a  
p a  
p $0

Gives me:

“C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/realstuff.rb”  
“C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5”

ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 6, 2009, 6:00pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/11 "2009-04-06T18:00:43Z")

</div>

Lars,

Thanks for you post, can I just check a couple of things?

1. You managed to get the iplayer-dl-0.1.15.rb compiled as an exe with  
rubyscript2exe?
2. Where can i find thie realstuff.rb file that I need to edit, I don’t  
seem to have it.

Thanks

Charlie

Lars C. wrote:

> On Fri, Apr 3, 2009 at 4:47 PM, The Higgs bozo [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > Lars C. wrote:
> > 
> > > On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw  
> > > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > Nah, rubyscript2exe.rb works like a charm. ï¿½I assume you are talking  
> > about the frozen string exception which is a trivial fix (below).
> 
> Sorry, it does work with your fix, but still not via the gem. I need  
> to invoke realstuff.rb directly.
> 
> The $0 mangling is not working with paths on my setup:
> 
> This script:
> 
> a =  
> “C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/realstuff.rb”  
> $0 = a  
> p a  
> p $0
> 
> Gives me:
> 
> “C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/realstuff.rb”  
> “C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5”
> 
> ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 3, 2009, 8:40pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/12 "2009-04-03T20:40:38Z")

</div>

On Apr 3, 2009, at 9:47 AM, The Higgs bozo wrote:

> I understand your concern that it has not been updated for a while,  
> but  
> on the other hand it doesn’t need any updating apart from this one-  
> liner  
> fix. It is not uncommon for someone to write a sweet tool and then  
> fall  
> off the Earth for a time. You can help by writing the author  
> [rubyscript2exe at erikveen dot dds dot nl], or if you live in  
> Netherlands knock on his door and say, “Yo, change that line!” in  
> Dutch.

Something like “Verander dat lijn.” ought to do it.

Cheers–

## Charles

Charles J.  
Advanced Computing Center for Research and Education  
Vanderbilt University

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 6, 2009, 7:17pm UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/13 "2009-04-06T19:17:16Z")

</div>

On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”  
> “C:\Test\iplayer-dl-0.1.15\lib\iplayer.rb”
> 
> However if I try to execute iplayer.exe nothing happens in the console.

You are trying to build a .exe from a Ruby library. Nothing is  
supposed to happen when you just load the library. “bin/iplayer-dl”  
does the actual work.

---

<div class="post-metadata">

**Author:** ![openshac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@openshac](https://www.ruby-forum.com/u/openshac)\
**Post date:** [April 7, 2009, 9:31am UTC](https://www.ruby-forum.com/t/rubyscript2exe/164563/14 "2009-04-07T09:31:33Z")

</div>

Lars,

Apologies if I’m being dumb, but I’m really new to ruby

Just to confirm, are you saying that instead of:

ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”  
“C:\Test\iplayer-dl-0.1.15\lib\iplayer.rb”

I should have:

ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”  
“C:\Test\iplayer-dl-0.1.15\bin\iplayer-dl”

I tried that but got :  
Gathering Files…  
C:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
‘gem\_original\_require’: no such file to load – iplayer (LoadError)  
from  
C:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
‘require’  
from C:/Test/iplayer-dl-0.1.15/bin/iplayer-dl:9  
Copying files…  
Creating iplyaer-dl.exe …

Thanks

Charlie

Lars C. wrote:

> On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”  
> > “C:\Test\iplayer-dl-0.1.15\lib\iplayer.rb”
> > 
> > However if I try to execute iplayer.exe nothing happens in the console.
> 
> You are trying to build a .exe from a Ruby library. Nothing is  
> supposed to happen when you just load the library. “bin/iplayer-dl”  
> does the actual work.
