# Rubycocoa script application without nib

**URL:** <https://www.ruby-forum.com/t/rubycocoa-script-application-without-nib/169114>\
**Category:** Ruby\
**Created:** [May 29, 2009, 5:06pm UTC](https://www.ruby-forum.com/t/rubycocoa-script-application-without-nib/169114 "2009-05-29T17:06:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![william](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@william](https://www.ruby-forum.com/u/william)\
**Post date:** [May 29, 2009, 5:06pm UTC](https://www.ruby-forum.com/t/rubycocoa-script-application-without-nib/169114/1 "2009-05-29T17:06:51Z")

</div>

Hi,

A good topic for some sleepless nights. I searched several times the  
whole google index for a solution but my efforts were in vain. So I  
turn to you, as last resort for salvation, and perhaps this can also  
help other tormented souls.

I am writing a thin wrapper around existing toolkits like f.ex Qt,  
Cocoa. I use a Mac as my primary platform and want the wrapper to be  
well integrated within the Cocoa ecosystem. When run under linux with  
Qt bindings installed it should use Qt, when under Gnome it should use  
Gtk etc.

This thin wrapper shouldn’t introduce external dependencies like an  
external launcher.app, but it should suffice to gem install it and  
require it and use it without external help; so the same ruby  
interpreter, the same ruby process the same thread as the script.

For the moment I keep around an empty lauchner.app which sole purpose  
is to launch the ruby script containing the Cocoa code, so that when  
launched there is a default empty MainMenu which is load by  
NSApplicationMain and so that NSTextField get the keyboard input.

99% of the fonctionnality works as expected without the external  
launcher.app; only Key focus and  
MainMenu is still a mystery to solve. I found a possibility described  
on internet that from Objective-C the problem can be solved by  
invoking the NSApplicaton method ‘setAppleMenu’ which should do the  
trick but when called from RubyCocoa nothing happens.

As my project will reach a useable sate in a few weeks I would be  
thankful for any clean solution, before announcing my wrapper, that  
goes the Ruby/Gem way without special addition.

Regards,

William
