FastCGI can't find rubygems?

Hi all,
I’m trying to use Apache 2.0.52 and FastCGI on Mac OS 10.4.6 and I’m
having
some trouble. The server starts up fine, but I get the error at the
bottom
of this post once I make a request to the rails app. I was curious if
anyone had an idea as to why it wasn’t working. I have everything
installed
correctly (rubygems, fastcgi, ruby bindings, etc). I had this all up
and
running perfectly with lighttpd, but now I’m switching over to Apache
and
it’s giving me this trouble. Any ideas would be appreciated!

Thanks, Ryan

[Thu Jun 15 18:52:46 2006] [warn] FastCGI: (dynamic) server
“/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi” started (pid
23792)
/Users/ryan/Workspace/rails/photos/public/…/config/boot.rb:18:in
require': No such file to load -- rubygems (LoadError) from /Users/ryan/Workspace/rails/photos/public/../config/boot.rb:18 from /Users/ryan/Workspace/rails/photos/public/../config/environment.rb:11:in require’
from
/Users/ryan/Workspace/rails/photos/public/…/config/environment.rb:11
from /Users/ryan/Workspace/rails/photos/public/dispatch.fcgi:21:in
require' from /Users/ryan/Workspace/rails/photos/public/dispatch.fcgi:21 [Thu Jun 15 18:52:46 2006] [warn] FastCGI: (dynamic) server "/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi" (pid 23792) terminated by calling exit with status '1' [Thu Jun 15 18:52:51 2006] [warn] FastCGI: (dynamic) server "/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi" restarted (pid 23796) /Users/ryan/Workspace/rails/photos/public/../config/boot.rb:18:in require’:
No such file to load – rubygems (LoadError)
from /Users/ryan/Workspace/rails/photos/public/…/config/boot.rb:18
from
/Users/ryan/Workspace/rails/photos/public/…/config/environment.rb:11:in
require' from /Users/ryan/Workspace/rails/photos/public/../config/environment.rb:11 from /Users/ryan/Workspace/rails/photos/public/dispatch.fcgi:21:in require’
from /Users/ryan/Workspace/rails/photos/public/dispatch.fcgi:21
[Thu Jun 15 18:52:51 2006] [warn] FastCGI: (dynamic) server
“/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi” (pid 23796)
terminated by calling exit with status ‘1’
[Thu Jun 15 18:52:56 2006] [warn] FastCGI: (dynamic) server
“/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi” restarted (pid
23797)
/Users/ryan/Workspace/rails/photos/public/…/config/boot.rb:18:in
require': No such file to load -- rubygems (LoadError) from /Users/ryan/Workspace/rails/photos/public/../config/boot.rb:18 from /Users/ryan/Workspace/rails/photos/public/../config/environment.rb:11:in require’
from
/Users/ryan/Workspace/rails/photos/public/…/config/environment.rb:11
from /Users/ryan/Workspace/rails/photos/public/dispatch.fcgi:21:in
require' from /Users/ryan/Workspace/rails/photos/public/dispatch.fcgi:21 [Thu Jun 15 18:52:56 2006] [warn] FastCGI: (dynamic) server "/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi" (pid 23797) terminated by calling exit with status '1' [Thu Jun 15 18:53:01 2006] [warn] FastCGI: (dynamic) server "/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi" restarted (pid 23798) /Users/ryan/Workspace/rails/photos/public/../config/boot.rb:18:in require’:
No such file to load – rubygems (LoadError)
from /Users/ryan/Workspace/rails/photos/public/…/config/boot.rb:18
from
/Users/ryan/Workspace/rails/photos/public/…/config/environment.rb:11:in
require' from /Users/ryan/Workspace/rails/photos/public/../config/environment.rb:11 from /Users/ryan/Workspace/rails/photos/public/dispatch.fcgi:21:in require’
from /Users/ryan/Workspace/rails/photos/public/dispatch.fcgi:21
[Thu Jun 15 18:53:01 2006] [warn] FastCGI: (dynamic) server
“/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi” (pid 23798)
terminated by calling exit with status ‘1’
[Thu Jun 15 18:53:01 2006] [warn] FastCGI: (dynamic) server
“/Users/ryan/Workspace/rails/photos/public/dispatch.fcgi” has failed to
remain running for 30 seconds given 3 attempts, its restart interval has
been backed off to 600 seconds


View this message in context:
http://www.nabble.com/FastCGI-can't-find-rubygems--t1795234.html#a4892121
Sent from the RubyOnRails Users forum at Nabble.com.

Check out your dispatch.fcgi file.
The first line propably reads
#!/usr/bin/ruby

And that points to the default MacOS X ruby. However you need to
update that to the Ruby location you use.
You can type the command
which ruby
To see the location of your Ruby. If you have used the port
installation the line you should use is likely:
#!/usr/local/bin/ruby

On 6/15/06, Wuher [email protected] wrote:

Thanks, Ryan
from /Users/ryan/Workspace/rails/photos/public/…/config/environment.rb:11
No such file to load – rubygems (LoadError)
terminated by calling exit with status ‘1’
from /Users/ryan/Workspace/rails/photos/public/dispatch.fcgi:21:in
from /Users/ryan/Workspace/rails/photos/public/…/config/boot.rb:18
[Thu Jun 15 18:53:01 2006] [warn] FastCGI: (dynamic) server
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

That’s interesting. I had changed it to:
#!/usr/bin/env ruby

so that when I use rake deploy, when it copies over this copy to my
production server, it will use the correct version of ruby since it is
in a different place than on my Mac here. Why doesn’t that work? Why
did it work with Lighttpd?

I did what you said and it work now (Thank you!), but I’m still
curious why my way fails.

Thanks, Ryan