Standalone Passenger on OS X Lion

After upgrading to Lion I can’t run standalone passenger. It throws following error when I tried to compile it using passenger package-runtime.

** Execute (dry run) nginx
/Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:224:in `*': negative argument (ArgumentError)
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:224:in `show_progress'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:147:in `install!'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:423:in `install_passenger_support_files'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:328:in `run_rake_task!'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:323:in `popen'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:323:in `run_rake_task!'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:422:in `install_passenger_support_files'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:421:in `chdir'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:421:in `install_passenger_support_files'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:143:in `install!'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/abstract_installer.rb:63:in `start'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/package_runtime_command.rb:65:in `run'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/main.rb:93:in `run_command'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/main.rb:48:in `each_command'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/main.rb:43:in `each'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/main.rb:43:in `each_command'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/main.rb:91:in `run_command'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/main.rb:62:in `run!'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/lib/phusion_passenger/standalone/main.rb:39:in `run!'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/gems/passenger-3.0.7/bin/passenger:32
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/bin/passenger:19:in `load'
    from /Users/vhyza/.rvm/gems/ruby-1.8.7-p330@dummy/bin/passenger:19

This error is caused (probably) by newer rake. Workaround for this is uninstalling newer version (in my case 0.9.2) and use older 0.8.7. But when I executed passenger package-runtime after that, it throws another error.

cc1: warnings being treated as errors
src/http/ngx_http_file_cache.c: In function ‘ngx_http_file_cache_create_key’:
src/http/ngx_http_file_cache.c:216: warning: ‘MD5_Init’ is deprecated (declared at /usr/include/openssl/md5.h:113)
src/http/ngx_http_file_cache.c:226: warning: ‘MD5_Update’ is deprecated (declared at /usr/include/openssl/md5.h:114)
src/http/ngx_http_file_cache.c:233: warning: ‘MD5_Final’ is deprecated (declared at /usr/include/openssl/md5.h:115)
make[1]: *** [objs/src/http/ngx_http_file_cache.o] Error 1
make: *** [build] Error 2

This time its nginx compile error. Thanks to google code issues there is a workaround too. It seems, Lion has newer version of openssl libraries and nginx calls some deprecated functions. Suggested workaround (which requires homebrew) is following.

First install openssl libraries using

brew install openssl

then use installed openssl libraries instead default OS X one

brew link openssl

after that try build standalone passenger again.

passenger package-runtime

If everything is working, don’t forget to unlink homebrew openssl library

brew unlink openssl

If you get following error,

passenger start
*** ERROR ***
Could not start Passenger Nginx core:
nginx: [alert] could not open error log file: open()
"/tmp/passenger-standalone.38744/logs/error.log" failed (2: No such file or
directory)
nginx: [alert] Unable to start the Phusion Passenger watchdog because it
encountered the following error during startup: Unable to start the Phusion
Passenger logging agent because its executable
(/Users/vhyza/.passenger/standalone/3.0.7-x86_64-ruby1.8.7-macosx-10.7/support/a
gents/PassengerLoggingAgent) doesn't exist. This probably means that your
Phusion Passenger installation is broken or incomplete. Please reinstall Phusion
Passenger (-1: Unknown error)
Stopping web server... done

you can try delete passenger build files

rm -rf ~/.passenger

and after that run

brew link openssl
passenger start

If building ends with

All done!

=============== Phusion Passenger Standalone web server started ===============
PID file: /private/tmp/dummy/tmp/pids/passenger.3000.pid
Log file: /private/tmp/dummy/log/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/

You can stop Phusion Passenger Standalone by pressing Ctrl-C.
===============================================================================

you won :). After that don’t forget to run

brew unlink openssl

Hope this workaround helps to run standalone passenger on Mac OS X Lion.

OS X, ruby

Homebrew without Xcode »

Comments