# Rubycocoa embedded ruby interpreter

**URL:** <https://www.ruby-forum.com/t/rubycocoa-embedded-ruby-interpreter/53090>\
**Category:** Ruby\
**Created:** [January 25, 2006, 1:03am UTC](https://www.ruby-forum.com/t/rubycocoa-embedded-ruby-interpreter/53090 "2006-01-25T01:03:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [January 25, 2006, 1:03am UTC](https://www.ruby-forum.com/t/rubycocoa-embedded-ruby-interpreter/53090/1 "2006-01-25T01:03:44Z")

</div>

rubies-

```
I have asked before but it got lost in the shuffle. I am working on

```

a bunch of rubycocoa apps for the newspaper I work for. And it is  
time to deploy them on other machines. I would really like to be able  
to embed the ruby interpreter binary and the libs I need inside of  
the OSX .app executable. Does anyone out there know how this could be  
done? Or maybe have already done so? SHould I be looking at  
rubyscript2exe’s osx support to see how that works?

```
I would really appreciate any direction on this as I am at a loss

```

and really need this functionality.

Thanks ever so much

-Ezra

---

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [January 25, 2006, 6:11am UTC](https://www.ruby-forum.com/t/rubycocoa-embedded-ruby-interpreter/53090/2 "2006-01-25T06:11:33Z")

</div>

I “spiked” on this a while back. You have several options, especially  
once you fire up Xcode.

Rubyscript2exe worked well the first time I tried it. I even threw  
Rails + FXRuby at it. I followed the documentation and I had Windows  
and OS X executables, as advertised. It even handled project-relative  
file paths just fine.

Now, if I recall correctly, rubyscript2exe expands its contents into  
a temp directory. That took a noticeable amount of time with my app.  
I think it may need to repeat the expansion every time you launch the  
app, but I could be wrong.

More recently, I tried rubyscript2exe again on the same app: more  
code, but nothing else different. I kept running into “too many open  
files.” As far as I can tell, there is no fix or workaround on OS X.  
The culprit is some rubyscript2exe file manipulation code. It does  
look possible to debug and perhaps fix this code.

“Programming Ruby” (the pickaxe) chapter 21 is a good guide for  
embedding Ruby. After some determined fiddling with Xcode, I was able  
to write a simple nicely-packaged Cocoa app that called Ruby code.  
Unfortunately, in my naive approach, Rails didn’t load its required  
files. I’m pretty sure that with a better understanding of Objective-  
C, Xcode, and embedded Ruby, this approach should work just fine.

In the end, the FXRuby part of my app always runs on dev machines, so  
I made a .term file that kicks off a bash script. That’s really all I  
need, though it bugs me that I don’t have a nice icon on in the dock.

You may have an easier time of it with RubyCocoa, but then again, I  
wonder if RubyCocoa embedded in a real Cocoa app might be like  
putting two Siamese Fighting Fish in the same tank?

Hope that is of some help,  
Scott

---

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [January 27, 2006, 5:21pm UTC](https://www.ruby-forum.com/t/rubycocoa-embedded-ruby-interpreter/53090/3 "2006-01-27T17:21:11Z")

</div>

On Wed, 25 Jan 2006 09:00:50 +0900, Ezra Z. wrote:

> I have asked before but it got lost in the shuffle. I am working on  
> a bunch of rubycocoa apps for the newspaper I work for. And it is time to  
> deploy them on other machines. I would really like to be able to embed the  
> ruby interpreter binary and the libs I need inside of the OSX .app  
> executable. Does anyone out there know how this could be done? Or maybe  
> have already done so? SHould I be looking at rubyscript2exe’s osx support  
> to see how that works?
> 
> I would really appreciate any direction on this as I am at a loss  
> and really need this functionality.

Please take a look at my little script which does this:

[http://www.dcs.gla.ac.uk/~jp/standaloneify.rb](http://www.dcs.gla.ac.uk/~jp/standaloneify.rb)

Also, try the rubycocoa mailing list for related questions.

Cheers,  
Jonathan

---

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [January 27, 2006, 8:16pm UTC](https://www.ruby-forum.com/t/rubycocoa-embedded-ruby-interpreter/53090/4 "2006-01-27T20:16:45Z")

</div>

On Jan 27, 2006, at 8:19 AM, Jonathan Paisley wrote:

> > have already done so? SHould I be looking at rubyscript2exe’s osx  
> > Also, try the rubycocoa mailing list for related questions.
> 
> Cheers,  
> Jonathan

Jonathan-

```
Great thank you very much. i wasn't aware of a rubycocoa mailing

```

list but I will sign up right away. A really appreciate you answering  
my question.

Thanks so much-

Ezra
