# Ruby-opengl on Mac OS X

**URL:** <https://rubytalk.org/t/ruby-opengl-on-mac-os-x/40772>\
**Category:** ruby-talk\
**Created:** [20 September 2007 04:31 UTC](https://rubytalk.org/t/ruby-opengl-on-mac-os-x/40772 "2007-09-20T04:31:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fearless\_Fool](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@Fearless\_Fool](https://rubytalk.org/u/Fearless_Fool)\
**Post date:** [20 September 2007 04:31 UTC](https://rubytalk.org/t/ruby-opengl-on-mac-os-x/40772/1 "2007-09-20T04:31:38Z")

</div>

All: Pardon this noobish question. I'm trying to bring up ruby-opengl  
on my Mac OS X (v 10.4.10).

I ran "sudo gem install ruby-opengl" without any trouble -- gem  
announced that it was loading ruby-opengl 0.40.1 as well as mkrf-0.2.2  
-- so far so good! I poked around and found that it had installed the  
following file (among others):

&nbsp;&nbsp;/usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/lib/opengl.rb

This looks hopeful. In irb, I typed:

&nbsp;&nbsp;irb(main):106:0\> require 'opengl'

which resulted in:

&nbsp;&nbsp;LoadError: no such file to load -- opengl  
&nbsp;&nbsp;from  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem\_original\_require'  
&nbsp;&nbsp;from  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require'  
&nbsp;&nbsp;from (irb):106  
&nbsp;&nbsp;from /usr/local/lib/ruby/site\_ruby/1.8/rubygems.rb:399

My question: My guess is this is a problem with paths. What is the  
cleanest remedy? Do I extend my path, make symbolic links, or move the  
opengl files?

Thanks.

- ff

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Gregory\_Seidman](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@Gregory\_Seidman](https://rubytalk.org/u/Gregory_Seidman)\
**Post date:** [20 September 2007 13:38 UTC](https://rubytalk.org/t/ruby-opengl-on-mac-os-x/40772/2 "2007-09-20T13:38:28Z")

</div>

> All: Pardon this noobish question. I'm trying to bring up ruby-opengl  
> on my Mac OS X (v 10.4.10).
> 
> I ran "sudo gem install ruby-opengl" without any trouble -- gem  
> announced that it was loading ruby-opengl 0.40.1 as well as mkrf-0.2.2  
> -- so far so good! I poked around and found that it had installed the  
> following file (among others):
> 
> &nbsp;&nbsp;/usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/lib/opengl.rb
> 
> This looks hopeful. In irb, I typed:
> 
> &nbsp;&nbsp;irb(main):106:0\> require 'opengl'
> 
> which resulted in:
> 
> &nbsp;&nbsp;LoadError: no such file to load -- opengl  
> &nbsp;&nbsp;from  
> /usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> `gem\_original\_require'  
> &nbsp;&nbsp;from  
> /usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> `require'  
> &nbsp;&nbsp;from (irb):106  
> &nbsp;&nbsp;from /usr/local/lib/ruby/site\_ruby/1.8/rubygems.rb:399
> 
> My question: My guess is this is a problem with paths. What is the  
> cleanest remedy? Do I extend my path, make symbolic links, or move the  
> opengl files?

I think you want to require 'gl' rather than 'opengl'. With a working  
install of ruby-opengl on 10.4.10 I have the following in a working Ruby  
script:

require 'rubygems'  
require 'gl'  
require 'glu'  
require 'glut'

You don't need GLU or GLUT unless you're using them, mind you.

> Thanks.  
> - ff

--Greg

> **···**
>
> On Thu, Sep 20, 2007 at 01:31:38PM +0900, Robert Poor wrote:

---

<div class="post-metadata">

**Author:** ![Fearless\_Fool](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@Fearless\_Fool](https://rubytalk.org/u/Fearless_Fool)\
**Post date:** [20 September 2007 19:11 UTC](https://rubytalk.org/t/ruby-opengl-on-mac-os-x/40772/3 "2007-09-20T19:11:27Z")

</div>

Gregory Seidman wrote:

> ...  
> I think you want to require 'gl' rather than 'opengl'. With a working  
> install of ruby-opengl on 10.4.10 I have the following in a working Ruby  
> script:
> 
> require 'rubygems'  
> require 'gl'  
> require 'glu'  
> require 'glut'
> 
> You don't need GLU or GLUT unless you're using them, mind you.
> 
> --Greg

Greg:

Whoo hoo! It Just Works. Many thanks.

- Rob

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Sy\_Yoon](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Sy\_Yoon](https://rubytalk.org/u/Sy_Yoon)\
**Post date:** [12 October 2007 07:18 UTC](https://rubytalk.org/t/ruby-opengl-on-mac-os-x/40772/4 "2007-10-12T07:18:49Z")

</div>

Fearless Fool wrote:

> Gregory Seidman wrote:
> 
> > ...  
> > I think you want to require 'gl' rather than 'opengl'. With a working  
> > install of ruby-opengl on 10.4.10 I have the following in a working Ruby  
> > script:
> > 
> > require 'rubygems'  
> > require 'gl'  
> > require 'glu'  
> > require 'glut'
> > 
> > You don't need GLU or GLUT unless you're using them, mind you.
> > 
> > --Greg
> 
> Greg:
> 
> Whoo hoo! It Just Works. Many thanks.
> 
> - Rob

Hello, Greg and Rob, Sorry for my newbie question in advance.

I am in very similar situation as Rob was in: I installed  
ruby-opengl-0.40.1  
in OS X(v. 10.4.10), and found 'opengl.rb' and others in

/usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/lib/opengl.rb

But when I do irb(main):003:0\> require 'gl'  
I get the following error:

LoadError: Failed to lookup Init function ./gl.bundle  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from ./gl.bundle  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2

(Well, 'opengl.rb' file contains line "require 'gl'" anyway, but when I  
do  
irb(main):003:0\> require 'opengl', I receive:  
LoadError: Failed to lookup Init function ./gl.bundle  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from ./gl.bundle  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from ./opengl.rb:16  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1:in `require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1 )

I also tried to test run 'plane.rb' file located in  
/usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/lib/examples  
using TextMate and got the following:

/Volumes/TextMate1.5.5/TextMate.app/Contents/SharedSupport/Support/lib/  
scriptmate.rb:107:in `initialize': Permission denied -  
/usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/examples/plane.rb  
(Errno::EACCES) from /Volumes/TextMate

What am I doing wrong?

Sy

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Julian\_Raschke1](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Julian\_Raschke1](https://rubytalk.org/u/Julian_Raschke1)\
**Post date:** [12 October 2007 08:08 UTC](https://rubytalk.org/t/ruby-opengl-on-mac-os-x/40772/5 "2007-10-12T08:08:11Z")

</div>

Hi,

> /Volumes/TextMate1.5.5/TextMate.app/Contents/SharedSupport/Support/lib/  
> scriptmate.rb:107:in `initialize': Permission denied -  
> /usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/examples/plane.rb  
> (Errno::EACCES) from /Volumes/TextMate
> 
> What am I doing wrong?

I think TextMate needs write access to files to run them (bug?). I had  
the very same problem yesterday, even with a 'properly' installed  
TextMate, and I ended up copying the example .rb files to the Desktop.  
Could run them from there without problems.

Julian

---

<div class="post-metadata">

**Author:** ![Sy\_Yoon](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Sy\_Yoon](https://rubytalk.org/u/Sy_Yoon)\
**Post date:** [12 October 2007 09:39 UTC](https://rubytalk.org/t/ruby-opengl-on-mac-os-x/40772/6 "2007-10-12T09:39:30Z")

</div>

Julian Raschke wrote:

> Hi,
> 
> > /Volumes/TextMate1.5.5/TextMate.app/Contents/SharedSupport/Support/lib/  
> > scriptmate.rb:107:in `initialize': Permission denied -  
> > /usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/examples/plane.rb  
> > (Errno::EACCES) from /Volumes/TextMate
> > 
> > What am I doing wrong?
> 
> I think TextMate needs write access to files to run them (bug?). I had  
> the very same problem yesterday, even with a 'properly' installed  
> TextMate, and I ended up copying the example .rb files to the Desktop.  
> Could run them from there without problems.
> 
> Julian

Ok, I copied an exmple rb file to the Desktop where TextMate is, but  
still get:

LoadError: Failed to lookup Init function  
/usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/lib/gl.bundle

method require in custom\_require.rb at line 32  
at top level in gl-test.rb at line 46

???

BTW, my TextMate is a trial version.

Sy

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Jesus\_Gabriel\_y\_Gala](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@Jesus\_Gabriel\_y\_Gala](https://rubytalk.org/u/Jesus_Gabriel_y_Gala)\
**Post date:** [12 October 2007 22:22 UTC](https://rubytalk.org/t/ruby-opengl-on-mac-os-x/40772/7 "2007-10-12T22:22:32Z")

</div>

Don't know if it might be the same problem, but just in case. I was  
trying to install opengl in Ubuntu, but couldn't make it work, until  
someone pointed to me that opengl.0.40.1 required version 1.9+ of  
rubygems. So maybe you could try to upgrade to version 1.9 to see if  
that's the problem?

In Ubuntu:

sudo gem update --system

Don't know how to do it in Mac OS X, though.

Hope this helps,

Jesus.

> **···**
>
> On 10/12/07, Sy Yoon \<fold3mani@yahoo.com\> wrote:
> 
> > Julian Raschke wrote:  
> > \> Hi,  
> > \>  
> > \>\> /Volumes/TextMate1.5.5/TextMate.app/Contents/SharedSupport/Support/lib/  
> > \>\> scriptmate.rb:107:in `initialize': Permission denied -  
> > \>\> /usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/examples/plane.rb  
> > \>\> (Errno::EACCES) from /Volumes/TextMate  
> > \>\>  
> > \>\> What am I doing wrong?  
> > \>  
> > \> I think TextMate needs write access to files to run them (bug?). I had  
> > \> the very same problem yesterday, even with a 'properly' installed  
> > \> TextMate, and I ended up copying the example .rb files to the Desktop.  
> > \> Could run them from there without problems.  
> > \>  
> > \> Julian
> > 
> > Ok, I copied an exmple rb file to the Desktop where TextMate is, but  
> > still get:
> > 
> > LoadError: Failed to lookup Init function  
> > /usr/local/lib/ruby/gems/1.8/gems/ruby-opengl-0.40.1/lib/gl.bundle
> > 
> > method require in custom\_require.rb at line 32  
> > at top level in gl-test.rb at line 46
> > 
> > ???
> > 
> > BTW, my TextMate is a trial version.
