views:

701

answers:

5

Hi all,

I can't seem to be get Ruby installed on my Mac. These are the steps I've taken so far:

  1. Downloaded the package from Ruby's site (http://www.ruby-lang.org/en/downloads/)
  2. Unpacked it running { tar xzvf ruby-1.9.1-p376.tar.gz }
  3. Went into the new ruby folder, and configured using {./configure}

This is where the error happens. When I run the configure, it gives me the error:


/usr/local/include/fuse/fuse_common.h:32:2: error: #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags! In file included from /usr/local/include/fuse/fuse.h:857, from :0: /usr/local/include/fuse/fuse_compat.h:69:24: error: sys/statfs.h: No such file or directory


As a result, I can't make the package nor install it. I have no idea what is wrong. Any help is greatly appreciated. Thanks!

A: 

What happens if you set C_Flags or CPP_Flags before doing your ./configure?

JT
Sorry I'm pretty new at this, but what do those mean? I tried running the following command from a Ruby-installation tutorial, but got another error: {./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1} // ERROR: {readline.c:1159: error: ‘username_completion_function’ undeclared (first use in this function)readline.c:1159: error: (Each undeclared identifier is reported only oncereadline.c:1159: error: for each function it appears in.)make[1]: *** [readline.o] Error 1make: *** [mkmain.sh] Error 1} // Are there other C_Flags I can use to configure?
funkymunky
isn't it C_FLAGS? not CFLAGS=?
JT
+3  A: 

Have you tried RVM? It lets you manage multiple versions of ruby and will take of installing them and managing any gem versions for you. It's pretty magic!

After you've installed it all you need to do is:

`rvm install 1.9`

Done!

jonnii
I second this. It makes managing *multiple* ruby's much easier. Wayne Seguin has done a brilliant job, and is very responsive in irb (#rvm on freenode).
Jamie van Dyke
Ok tried using RVM, but some problems with that as well. I followed the directions on RVM's website, and ran gem install rvm. After that, though, I can't seem to run the command 'rvm install 1.9.1'. It either says it doesn't know the "rvm" command or there's an error with 'make'. I've used 'make' just fine before, so not sure what the problem is.
funkymunky
Have you installed xcode?
jonnii
yes I have Xcode 3.2.1 installed.
funkymunky
You may need to use rvm-install first to set up paths, etc.
Dave Bacher
A: 

This isnt ananswer so much as a suggested alternative... use macports :-)

prodigitalson
I used macports and ran 'Sudo port install ruby19 +nosuffix'. Everything works now, though I still couldn't get RVM to work. I'll have to figure that out later. Thanks for all the help guys I really appreciate it
funkymunky
make sure your path is properly configured to use the gem installer/ruby in `/opt/local` as opposed to the system. It should auto configure this for you but ive found with some ports it fails to take effect (probably because they arent directly in bin or sbin but have their own tree - eg. apache2, mysql, etc.). as long as `/opt/local/bin` and `/opt/local/sbin` are on your path before anywhere else you should be ok though.
prodigitalson
how do I configure this?
funkymunky
open `~/.bash_profile` in a text editor and look for `export PATH=` followed by a series of paths separated by `:`. If `/opt/local/bin` and `/opt/local/sbin` arent at the front of that path add them like `export PATH=/opt/local/bin:/opt/local/sbin:/any/other/path/currently/here:$PATH` You might want to open a new question about "Shell Profiles" for more info. Or just Google it.
prodigitalson
+1  A: 

Looks like others have run into this issue.

If you want need the binary, you could try rubyosx.

I guessing that the issue is that you have FUSE (or MacFUSE) installed in /usr/local and for whatever reason, the configure phase is doing something that's including it. If you're not trying to build ruby with some local extensions, but you want to build ruby yourself, try moving aside /usr/local (at least temporarily).

sudo mv /usr/local /usr/local.aside

(Beware, randomly messing with /usr and /usr/local directories can lead to trouble.)

Dave Bacher
This makes sense. I've uninstalled MacFUSE and now the previous error message about 'include/fuse' is gone. However, the configure still has errors saying it can't find libxml/tree.h and libxml/xpath.h. If I go ahead with the make anyway, it returns the following error: {readline.c:1159: error: ‘username_completion_function’ undeclared (first use in this function)readline.c:1159: error: (Each undeclared identifier is reported only oncereadline.c:1159: error: for each function it appears in.)make[1]: *** [readline.o] Error 1make: *** [mkmain.sh] Error 1}
funkymunky
you need to compile and install libxml as well or provide the path to libxml when you run `configure` - probably something like `./configure --with-libxml=/path/to/libxml` but im not sure as its been a couple years since i manually compiled ruby.
prodigitalson
This is getting ugly. Unless you're really eager to learn about building software and all dependencies. I'd recommend going with a pre-built package from rubyosx, or using a real packaging system like fink or macports (as suggested by others).
Dave Bacher
+1  A: 

If the last line of configure output is

config.status: creating Makefile

then you have a makefile and you can try building it.

I got the fuse.h error, and just ran make to build a working ruby:

[neilk@maczombie ~]$ ruby --version
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin10.2.0]
nedski
this is the easiest answer - fuse support only matters if you want to use or build fuse filesystems...
Asher