Ruby Header Files in Mac OS X

A

Ari Brown

[Snow-iMac:~/Desktop/Programming/rubyforger] ari% ruby extconf.rb
can't find header files for ruby.

Am I the only one having this issue? I have found ruby.h (assuming
that's the file it's looking for), and it's in the normal directory.
I have had this issue every time I try to install a new Ruby library.

I suppose ruby.h is not the file it's looking for?

Thanks,
Ari
--------------------------------------------|
If you're not living on the edge,
then you're just wasting space.
 
H

Henry Maddocks

[Snow-iMac:~/Desktop/Programming/rubyforger] ari% ruby extconf.rb
can't find header files for ruby.

Am I the only one having this issue? I have found ruby.h (assuming
that's the file it's looking for), and it's in the normal
directory. I have had this issue every time I try to install a new
Ruby library.

I suppose ruby.h is not the file it's looking for?

Have you set up your paths correctly?

$ whereis ruby
/usr/bin/ruby
$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/bin:/sbin:/usr/
bin:/usr/sbin


The path to ruby should be in your $PATH
 
A

Ari Brown

[Snow-iMac:~/Desktop/Programming/rubyforger] ari% ruby extconf.rb
can't find header files for ruby.

Am I the only one having this issue? I have found ruby.h (assuming
that's the file it's looking for), and it's in the normal
directory. I have had this issue every time I try to install a new
Ruby library.

I suppose ruby.h is not the file it's looking for?

Have you set up your paths correctly?

$ whereis ruby
/usr/bin/ruby
$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/bin:/sbin:/usr/
bin:/usr/sbin

I can run ruby just fine, but to be sure, I checked. And yup, Ruby's
in my path.

Sweet Ruby Gods please help me
~ Ari
English is like a pseudo-random number generator - there are a
bajillion rules to it, but nobody cares.
 
T

Tim Hunter

Ari said:
Sweet Ruby Gods please help me

You're running the version of Ruby that comes pre-installed with OS X,
right? Apple got the header files installed in the wrong location. Your
best bet is to install your own version of Ruby in /usr/local.
 
A

Ari Brown

You're running the version of Ruby that comes pre-installed with OS
X, right? Apple got the header files installed in the wrong
location. Your best bet is to install your own version of Ruby in /
usr/local.


Couldn't I just move the file around? And should I reinstall it in /
usr/bin or /usr/local?

Thank you. I will frame this email.
-------------------------------------------|
Nietzsche is my copilot
 
T

Tim Hunter

Ari said:
Couldn't I just move the file around? And should I reinstall it in
/usr/bin or /usr/local?
You could, but installing your own version of Ruby is easy and you can
keep up with new releases. Not to mention you become the master of your
own destiny, at least as far as Ruby is concerned :)

You should install it in /usr/local and then modify your PATH to put
/usr/local in front. Put this in your ~/.profile file:

export PATH=/usr/local:$PATH

You can learn about PATH and .profile by issuing the "man bash" command
in a Terminal window, or just Google it.
 
H

Henry Maddocks

Couldn't I just move the file around? And should I reinstall it in /
usr/bin or /usr/local?

By installing your own version of ruby you can be reasonably sure
that everything will be correct. If you start mucking about with the
existing version you might break something and never be able to fix
it without re-installing.

Anyway...

It's not one file it's directory that is in the wrong place. Where is
your ruby currently residing? If it is /usr/bin then check in /usr/
lib to see if there is a ruby directory.
 
J

John Joyce

Ok everyone - it worked. Thanks everyone for helping me through
this issue. It was like the midlife crisis of my teens.

BUT when I tried to change my path, it didn't work. I'm using tcsh,
and am doing two things:
setting my path directly through the command line:
setenv PATH /usr/local/bin/:$PATH

and through /private/etc/csh.cshrc
I am adding setenv PATH /usr/local/bin/:$PATH to the end of the
file and saving it.

Which version of OSX are you using?
The tcsh shell was default in Panther, but in Tiger default is bash.
Bash is a bit easier, since there is more current stuff on blogs and
websites to help you with that.
Either way, consider getting the book Unix in a Nutshell. It covers
all the major unixes including OSX and the major shells.
You'll find it handy as a reference when you want to install or
change things in OSX.
the Hivelogic site does have pretty much the best and most up-to-date
how-to's on installing Ruby/Rails/etc... on OSX.
The preferred environment is to do your own install, since Apple
admittedly munged the factory Ruby install.
Good news is, it is easy to do and the experience will help you
learning about the unix command line environment more.
More good news, the next OSX, Leopard, has it installed correctly.
 
L

Laurent Sansonetti

You're running the version of Ruby that comes pre-installed with OS X,
right? Apple got the header files installed in the wrong location. Your
best bet is to install your own version of Ruby in /usr/local.

This was IIRC fixed in 10.4.8.

I think that the problem Ari has is that he didn't select the
BSD/Xcode SDK when installing Mac OS X. By default the Ruby headers
are not installed, you need to implicitly specify this during install
(or post install, browse the DVD and install the right .pkg).

Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top