OS X eRuby working

I finally managed to get mod_ruby and eRuby working on OS X. I never had a
problem getting mod_ruby running, but when I tried enabling eRuby in my
httpd.conf file, apache couldn’t restart because it couldn’t find a bunch
of “rb_” symbols.

I a m running OS X v10.2.4. Here’s what I think I did:

  • Compile ruby 1.6.8 using configure flag --enable-shared. Install it.

  • Compile mod_ruby using configure flags --enable-eruby --with-apxs
    –enable-shared.

  • While compiling mod_ruby, I think it asked me to run ranlib on some
    library. I did so and re-ran make, then installed mod_ruby.

  • Compile eRuby using configure flag --enable-shared. Install it.

  • Put this in my httpd.conf file:

LoadModule ruby_module libexec/httpd/mod_ruby.so
AddModule mod_ruby.c

If the ruby module is installed, this will be enabled.

# for Apache::RubyRun RubyRequire apache/ruby-run

exec files under /ruby as ruby scripts.

<Location /ruby>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
Options ExecCGI

exec *.rb as ruby scripts.

<Files *.rb>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance

exec *.rbx as ruby scripts.

<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance

for Apache::ERubyRun

RubyRequire apache/eruby-run

handle files under /eruby as eRuby files by eruby.

<Location /eruby>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
Options ExecCGI

handle *.rhtml as eruby files.

<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance

for Apache::ERbRun

RubyRequire apache/erb-run

handle files under /erb as eRuby files by ERb.

<Location /erb>
SetHandler ruby-object
RubyHandler Apache::ERbRun.instance
Options ExecCGI

for debug

RubyRequire auto-reload

  • Restart apache using “sudo apachectl graceful”

Jim

···


Jim Menard, jimm@io.com, http://www.io.com/~jimm/
“Verbing weirds language.” – Calvin

Are there warnings on duplicate Ruby symbols in your Apache’s error_log
(I set log level to info in my httpd.conf). This is the only thing I
have left to resolve on my system. Everything works fine, though. Just
a bunch of warnings that I would like to get rid of.

Gennady.

···

On Wednesday, February 26, 2003, at 07:37 PM, Jim Menard wrote:

I finally managed to get mod_ruby and eRuby working on OS X. I never
had a
problem getting mod_ruby running, but when I tried enabling eRuby in my
httpd.conf file, apache couldn’t restart because it couldn’t find a
bunch
of “rb_” symbols.

I a m running OS X v10.2.4. Here’s what I think I did:

  • Compile ruby 1.6.8 using configure flag --enable-shared. Install it.

  • Compile mod_ruby using configure flags --enable-eruby --with-apxs
    –enable-shared.

  • While compiling mod_ruby, I think it asked me to run ranlib on some
    library. I did so and re-ran make, then installed mod_ruby.

  • Compile eRuby using configure flag --enable-shared. Install it.

  • Put this in my httpd.conf file:

LoadModule ruby_module libexec/httpd/mod_ruby.so
AddModule mod_ruby.c

If the ruby module is installed, this will be enabled.

# for Apache::RubyRun RubyRequire apache/ruby-run

exec files under /ruby as ruby scripts.

<Location /ruby>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
Options ExecCGI

exec *.rb as ruby scripts.

<Files *.rb>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance

exec *.rbx as ruby scripts.

<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance

for Apache::ERubyRun

RubyRequire apache/eruby-run

handle files under /eruby as eRuby files by eruby.

<Location /eruby>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
Options ExecCGI

handle *.rhtml as eruby files.

<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance

for Apache::ERbRun

RubyRequire apache/erb-run

handle files under /erb as eRuby files by ERb.

<Location /erb>
SetHandler ruby-object
RubyHandler Apache::ERbRun.instance
Options ExecCGI

for debug

RubyRequire auto-reload

  • Restart apache using “sudo apachectl graceful”

Jim

Jim Menard, jimm@io.com, http://www.io.com/~jimm/
“Verbing weirds language.” – Calvin

Gennady bystr@mac.com writes:

Are there warnings on duplicate Ruby symbols in your Apache’s error_log
(I set log level to info in my httpd.conf). This is the only thing I
have left to resolve on my system. Everything works fine, though. Just
a bunch of warnings that I would like to get rid of.

No, I’m not seeing any warnings.

Jim

···


Jim Menard, jimm@io.com, http://www.io.com/~jimm/
“Yeah, well, don’t count your weasels before they pop, dink.” – The Tick

Jim Menard jimm@io.com writes:

Gennady bystr@mac.com writes:

Are there warnings on duplicate Ruby symbols in your Apache’s error_log
(I set log level to info in my httpd.conf). This is the only thing I
have left to resolve on my system. Everything works fine, though. Just
a bunch of warnings that I would like to get rid of.

No, I’m not seeing any warnings.

No warning, but I haven’t mucked with the log level at all.

Sorry to follow up to my own post.

Jim

···


Jim Menard, jimm@io.com, http://www.io.com/~jimm/
“Mind you, deep in the IBM VM operating system source we once found a
comment that said ‘remember to collect laundry on way home’.”
– Alan J. Flavell in comp.lang.perl.misc