Search code examples
rubyapacheosx-snow-leopardrvmpassenger

Phusion Passenger: Trouble on deploying an application on the local machine


I am using Mac OS Snow Leopard, Apache Server, Phusion Passenger and RVM and I am trying to deploy on my local machine a RoR application.

In my ~.etc/apache/httpd.conf file I have:

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName mysite.com
  DocumentRoot /Users/MyUserName/Sites/mysite.com/public

  <Directory /Users/MyUserName/Sites/mysite.com/public>
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

When I browse the mysite.com address I get the following Phusion Passenger' error:

Error message:
    no such file to load -- bundler
Exception class:
    LoadError
Application root:
    /Users/MyUserName/Sites/mysite.com

Backtrace:
    #   File    Line    Location
    0   /Users/MyUserName/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb   36  in `require'
    1   /Users/MyUserName/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb   36  in `require'
    ...

How can I solve that?


Console outputs:

$ /usr/bin/ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0]

$ echo $PATH
/Users/MyUserName/.rvm/gems/ruby-1.9.2-p290/bin:/Users/MyUserName/.rvm/gems/ruby-1.9.2-p290@global/bin:/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/MyUserName/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin

$ which ruby gem irb rake
/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin/gem
/Users/MyUserName/.rvm/rubies/ruby-1.9.2-p290/bin/irb
/Users/MyUserName/.rvm/gems/ruby-1.9.2-p290/bin/rake

$ irb
1.9.2-p290 :001 > require "bundler"
 => true

Solution

  • I think you might have a mismatch in what ruby versions are used.

    Apache/passenger is probably set up to use your system ruby (1.8.7-p249), and not the ruby version you are obviously using with rvm, and I guess the reason you get the message that passenger cannot find bundler is because you haven't installed bundler using your system ruby.

    You can fix this either by installing bundler in the system ruby version, or by telling passenger to use whatever ruby version you have installed via rvm.