DEV Community

Perafán
Perafán

Posted on • Updated on

Install nginx with passenger in MacOS Monterey

Maybe if you have installed nginx and upgrade to the new macos monterrey you could have an issue starting nginx.

objc[65203]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[65203]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
Enter fullscreen mode Exit fullscreen mode

First we need to remove nginx

brew uninstall nginx # uninstall nginx-full
rm -rf /usr/local/etc/nginx
Enter fullscreen mode Exit fullscreen mode

Now we should reinstall nginx

brew tap denji/nginx
brew install nginx-full --with-passenger
Enter fullscreen mode Exit fullscreen mode

Edit your nginx.confg (/usr/local/etc/nginx/nginx.conf) and add the following code in the http scope:

passenger_root /usr/local/opt/passenger/libexec/src/ruby_supportlib/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/ruby;
passenger_env_var OBJC_DISABLE_INITIALIZE_FORK_SAFETY YES;

### If you're using rbenv passenger_ruby /Users/user/.rbenv/shims/ruby;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)