Unable to set up Rails app by Apache on Mac OS X 10.9.3


I just upgrade a few apps from Rails 2.3.18 to Rails 4.0.4 and make sure the apps are running on WEBrick. I follow the steps I have done to set up apps by Apache on Snow Leopard, first install passenger and add the following to /etc/apache2/httpd.conf

LoadModule passenger_module /usr/local/opt/passenger/libexec/buildout/apache2/mod_passenger.so

PassengerRoot /usr/local/opt/passenger/libexec/lib/phusion_passenger/locations.ini

PassengerDefaultRuby /usr/bin/ruby

then try to add RailsBaseURI /most (most is my rail project) in the .conf inside /etc/apache2/sites/, but no .conf file there anymore for Mac Marvericks, rather I find the .conf in folder /Library/Server/Web/Config/apache2/sites, so I add the “RailsBaseURI /most” in the file

Then I add a symlink as following:

ln -s /Library/WebServer/most/public /Library/WebServer/Documents/most

sudo apachectl stop sudo apachectl start

Page http://localhost/most is like following:

Index of /most

Wonder if something that I should do for Mac Mavericks or some setting for Apache that I am not aware?

Thanks! Liz Huang

i used to go through this kind of drama, then one day someone told about heroku.


and couldn’t display http://localhost/most/rannumgenerator/index (rannumgenerator is controller I generated in most project).

Wonder if something that I should do for Mac Mavericks or some setting for Apache that I am not aware?

You may need to look in your error log (probably in /var/log/apache2/) for more details on what happened to Passenger. Also, I’ve never tried accessing Rails projects under a subdirectory like that, you may need to see if you need to set up something specifically to handle that.

I set my system up quite a bit differently to easier support working on different projects. First, since Mac OS updates can overwrite http.conf, I put my custom config in the /etc/apache2/other/ directory, broken up into separate files. So, I have a passenger.conf file and a vhosts.conf file. I create entries in /etc/hosts to set up local domain names for my various projects. So I end up with something like this:

/etc/hosts: my.greatproject.local


LoadModule passenger_module /Users/jcrate/.rvm/gems/ruby-2.1.2@global/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so

PassengerRoot /Users/jcrate/.rvm/gems/ruby-2.1.2@global/gems/passenger-4.0.45

PassengerDefaultRuby /Users/jcrate/.rvm/gems/ruby-2.1.2@global/wrappers/ruby


<VirtualHost *:80>

ServerName my.greatproject.local

DocumentRoot /path/to/project/public

RackEnv development

PassengerRuby /Users/jcrate/.rvm/gems/ruby-2.1.2@myproject/wrappers/ruby

If you’re not using RVM, then your passenger-related paths will look a little different. However, if you have more than one Rails project, you probably want to be using RVM or some sort of ruby version manager.

Thanks! I will check heroku.


Thanks! I will try and see if I can figure it out, I use rbenv to manage ruby versions.

Best, Liz

I checked error log in apache2 folder, it is empty. I wonder if it is related to permission for folders or files as I am not using root, but admin account to develop rails projects.



If your goal is to sanity-check the app on httpd/Passenger because that's your production setup, you'd be far better off replicating that prod environment in a VM and testing there.


Hi, Jim:

I followed your advice, still couldn’t get my site running. Do you set up your rails project in Mac OSX Mavericks? It seems from its instruction, /etc/apache2/httpd.conf is /Library/Server/Web/Config/apache2/httpd_server_app.conf Wonder anyone here has luck setting up rails app in Mac OSX Mavericks.

Thanks! Liz

Yes, but I don't use the built-in apache and its configs. Honestly, if you want readily available help, probably best to turn off the "personal web sharing" and install & configure your own web server, in the "standard" unix-y location. I expect that would be easier than starting with Apple's built-in Apache config, which is configured for VERY basic personal use and then try to figure out to tweak their config. Also, if you install your own, it's less likely that OS updates will fubar your config and force you to go exploring again trying to figure out what to fix.

I personally just the built-in (to rails that is) service for development, then use nginx + unicorn for deployment.

I followed your advice, still couldn’t get my site running. Do you set up your rails project in Mac OSX Mavericks? It seems from its instruction, /etc/apache2/httpd.conf is /Library/Server/Web/Config/apache2/httpd_server_app.conf

Are you using Server.app? If so, then things are somewhat different. In fact, looking back at your original message I see you mentioned a Server-specific path.

You would want to put your passenger.conf file in /Library/Server/Web/Config/apache2/other/.

You can still edit your /etc/hosts file to include a local domain for your project, which will make things easier. You would then set up a new website in Server.app, using the domain you set up /etc/hosts for your project, and tell it site files are stored in the public folder of your rails project. I use RVM, so I have to edit the config file Server.app generates to add

PassengerRuby /usr/local/rvm/gems/ruby-2.1.2@my_gemset/wrappers/ruby

You can run this command from your rails project directory to see what you should be using for PassengerRuby:

passenger-config --ruby-command

If you want to run your rails app in development mode, you’ll also need to add

RackEnv development

to your site config file. Your site config file will be in:


and will be named something like:


Your passenger installation doesn’t necessarily need to be done via rbenv, it will be just fine installed with the system ruby. However, you will need the PassengerRuby directive so it knows where to find the ruby and gem set to use when it instantiates your project.


Actually, the default Mac OS X installation of apache is pretty standard (in a BSD sense). The config files live in /etc/apache2/, and *.conf files in /etc/apache2/other/ are loaded by default. My config files haven’t been touched even when upgrading from 10.8 to 10.9. It’s a little more tricky if you need PHP too, but it’s still not difficult to add modules to the built-in php.

In fact, the reason I started using the built-in apache was because I got tired of MacPorts blowing away all my config files seemingly at random.


Ugh, shudder, no, I *NEVER* use MacPorts. If configure/make/install won't get the job done, I seriously reconsider whether I need it. (I've only give up once, forget what it was, but the rat's nest of dependencies was too much to sort. But PostgreSQL, nginx, pgbouncer, libevent, ghostscript, are all pretty easy...)

I got rid of MacPorts in the early days of Homebrew. I also used to just configure/make/install, but ImageMagick was a real hassle, and keeping track of my config scripts which listed all the options I wanted was annoying as well. I’m pretty happy with Homebrew.


Dear Jm:

Thanks a lot for your reply!

Yes, server.app comes with Mavericks, so I use it to host Rails web apps and have tried to create passenger.conf under other folder etc. I set up everything in snow leopard under directory “/etc/apache2”, and sites folder was also inside /etc/apache2, it is quite straightfoward and easy, but when I try to do the samething with server.app under folder /Library/Server/Web/Config/apache2. I couldn’t make it work, the steps seem to be quite simple, but not easy to find out what might go wrong.

I used brew to install passenger.


Server admin in snow leopard is now server.app in Mavericks?


The config file used for the web server in Mavericks Server is httpd_server_app.conf. You may want to look in that file and make sure the line below exists and is not commented out. It should be near the end of the file.

Include /Library/Server/Web/Config/apache2/other/*.conf

I have never installed passenger with brew, only using ruby-gems either in the system ruby, or nowadays in RVM environments. So, I’m not sure of any differences there may be installing it with brew, but I don’t think there is any reason why it shouldn’t work.

It can be tricky to find out exactly what is going wrong. If you are still just getting the public directory listing when you load the site in your browser, then Passenger most likely has not been activated, which means there is some issue with your apache config. If Passenger is loading and you don’t have the PassengerRuby environment set up in your site config file properly, then you should get an error that Passenger can’t start the web app.

If Passenger isn’t loading at all, then check /var/log/apache2/error_log when you start your web server, and see what it says. It should have some info about the startup process, and if Passenger is loading it should be mentioned. If passenger is not mentioned, you can see if your passenger.conf file is getting loaded by changing the “LoadModule passenger_module” directive to have an incorrect path. When I do that, apache silently fails to start (i.e. nothing in the access or error logs).

Jim Crate

Thanks so much! I will carefully follow all your advice to see if I can get it work…

Best, Liz

Great, it seems that I got further, now I got error message

It looks like Bundler could not find a gem. Maybe you didn’t install all the gems that this application needs. To install your gems, please run:

bundle install

I did "bundle install" after I create the rails project, I did "gem uninstall passenger"
afterwards as the developer of passenger told me that I installed passenger by homebrew, I don't
need gem install passenger, o.w. I would have trouble...


The problem was caused that line

PassengerRuby pathForRuby

got wiped out in file httpd_server_app.conf after I recreate the websites.

Now I got this error message, didn’t find the fix…

  integer 4294967294 too big to convert to `int' (RangeError)
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/2.1.0/fileutils.rb:724:  in `chown'
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/2.1.0/fileutils.rb:724:  in `block in remove_entry_secure'
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/2.1.0/fileutils.rb:718:  in `open'
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/2.1.0/fileutils.rb:718:  in `remove_entry_secure'
/usr/local/Cellar/passenger/4.0.45/libexec/lib/phusion_passenger/utils/tmpio.rb:72:  in `ensure in mktmpdir'
/usr/local/Cellar/passenger/4.0.45/libexec/lib/phusion_passenger/utils/tmpio.rb:72:  in `mktmpdir'
/usr/local/Cellar/passenger/4.0.45/libexec/lib/phusion_passenger/native_support.rb:147:  in `download_binary_and_load'
/usr/local/Cellar/passenger/4.0.45/libexec/lib/phusion_passenger/native_support.rb:49:  in `start'
/usr/local/Cellar/passenger/4.0.45/libexec/lib/phusion_passenger/native_support.rb:405:  in `<top (required)>'
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:  in `require'
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:  in `require'
/usr/local/Cellar/passenger/4.0.45/libexec/lib/phusion_passenger.rb:237:  in `require_passenger_lib'
/usr/local/Cellar/passenger/4.0.45/libexec/helper-scripts/rack-preloader.rb:75:  in `init_passenger'
/usr/local/Cellar/passenger/4.0.45/libexec/helper-scripts/rack-preloader.rb:157:in `<module:  App>'
/usr/local/Cellar/passenger/4.0.45/libexec/helper-scripts/rack-preloader.rb:29:in `<module:  PhusionPassenger>'
/usr/local/Cellar/passenger/4.0.45/libexec/helper-scripts/rack-preloader.rb:28:in `<main>'

Application root /Library/WebServer/most Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV) development Ruby interpreter command


User and groups

uid=4294967294(nobody) gid=4294967294(nobody) groups=4294967294(nobody),12(everyone),61(localaccounts),

You just need to get your PassengerRuby directive set up properly then. That will need to be specified in your site configuration file in /Library/Server/Web/Config/apache2/sites/. You can use the passenger utility:

passenger-config --ruby-command

which will show you what your PassengerRuby directive should look like. I put that directive just above the closing tag in the site config file. If you want to run in development mode, you will also need the “RackEnv development” directive.

If you installed passenger using HomeBrew, then you do not want to list passenger as a requirement in your rails app Gemfile. Personally, I only list app-specific gems in the Gemfile, and leave out the server-specific details like Passenger.