macOS Sierra + latest Xcode + false error when doing an apachectl configtest after having installed using passenger-install-apache2-module

266 views
Skip to first unread message

Khooroos Lary

unread,
Oct 16, 2016, 2:54:00 PM10/16/16
to Phusion Passenger Discussions

On the latest version of mac OSX (Sierra macOS 10.12 - 16A323) passenger can get installed but it throws a false error on "apachectl configtest".

Installation instructions:

1) Start off by a default clean installation of Sierra macOS 10.12, with latest XCode and xcode command line tools

2) Install passenger gem using `sudo gem install passenger`

3) try to now use `passenger-install-apache2-module` to configure Apache

4) You will see that the above complains about Apache APR and APR utils not being present. It says don't worry we'll tell you how to install things but suggests to install the xcode command lines tools as the solution.  Now if you read point (1) above you see that I had already installed the command line tools.  Therefore this solution that it suggests is indeed incorrect.  The latest Xcode 10.12 needs the following to get past this error:

First make sure you install APR and APR util manually as outlined here: https://gist.github.com/zedshaw/4e14bbca46eb21aad08d  

Then make the following symlinks:
     
     sudo mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
     sudo ln -s /usr/local/apr/bin/apr-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
     sudo ln -s /usr/local/apr/bin/apu-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/

5) after that's done, you can install passenger as normal and try to `apachectl restart`.  Everything seems to work and you should be able to run your rails sites as usuall BUT, BUT BUT ... 

6) After you do the above, and try to do a `apachectl configtest`, you get the following error.  I should also add that luckily despite the error, you can still run the your site 

     
     mbp:~ me$ sudo apachectl configtest
     httpd: Syntax error on line 537 of /private/etc/apache2/httpd.conf: Syntax error on line 1 of
     /private/etc/apache2/other/_passenger.conf: Cannot load 
     /Library/Ruby/Gems/2.0.0/gems/passenger-5.0.30/buildout/apache2/mod_passenger.so into 
     server: dlopen(/Library/Ruby/Gems/2.0.0/gems/passenger-
     5.0.30/buildout/apache2/mod_passenger.so, 10): Library not loaded: /usr/local/apr/lib/libapr-
     1.0.dylib\n  Referenced from: /Library/Ruby/Gems/2.0.0/gems/passenger-
     5.0.30/buildout/apache2/mod_passenger.so\n  Reason: Incompatible library version: 
     mod_passenger.so requires version 6.0.0 or later, but libapr-1.0.dylib provides version 5.0.0



Screen Shot 2016-10-16 at 2.45.35 PM.png

Camden Narzt

unread,
Oct 24, 2016, 10:32:30 AM10/24/16
to Phusion Passenger Discussions
With Sierra, Apple removed the apr-1-config and apu-1-config files from Xcode. This may be a mistake and we may see them return in the next update but for now the easiest method to install Passenger is to use Homebrew. If you are sure you would like to install from the gem, then following the above process is close to what I'd recommend. With the exception that I'd suggest using the APU_CONFIG and APR_CONFIG env vars to point to apu-1-config and apr-1-config instead of using symlinks.
Reply all
Reply to author
Forward
0 new messages