Get localhost running on mac OS X Yosemite

Get localhost running on mac OS X Yosemite

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Restoring Apache on macOS Yosemite After a System Upgrade

Upgrading your operating system often feels like a fresh start, but it can abruptly sever the connection between your development environment and your browser. A common scenario involves moving from Mavericks to OS X Yosemite, where localhost suddenly stops resolving or responding, triggering an ERR_CONNECTION_REFUSED error in Chrome. While this might seem like a simple configuration issue, the root cause often lies deeper within the Apache module loading process.

The specific error message you are encountering—Cannot load libexec/apache2/mod_authn_default.so into server: dlopen(/usr/libexec/apache2/mod_authn_default.so, 10): image not found—is a classic symptom of how macOS handles system library paths during major upgrades. When you upgraded to Yosemite, Apple likely moved or renamed the core Apache modules. The configuration file from your previous OS (Mavericks) still references the old path (/usr/libexec/apache2/mod_authn_default.so), but that specific binary no longer exists at that location in Yosemite.

Attempting to bypass this by commenting out the failing module lines leads to a cascade of new errors. As soon as you remove mod_authn_core, Apache loses its ability to understand directives like User and Group. This results in the AH00526: Syntax error on line 131... Invalid command 'User' message. The server is essentially saying, "I don't know what this command means because I lack the module that defines it."

To resolve this, you must rebuild the Apache configuration for your current OS version rather than copying files from an older one. The most reliable approach is to use the system's built-in provisioning script. Run the following command in your terminal:

sudo apachectl configtest

If that returns a syntax error or module missing error, you need to reinstall the Apache configuration using the system installer:

sudo /usr/sbin/apachectl -k restart

However, if you are on Yosemite and find that the system Apache is still stubbornly failing with missing libraries, it is often better to switch to PHP's built-in server or a dedicated Nginx setup for local development. For many developers, the system Apache in Yosemite is too fragile for active development workloads compared to modern alternatives.

If you are working with a specific application stack like Laravel, remember that localhost resolution depends on both the web server and your DNS settings. Ensure your /etc/hosts file is correctly configured:

sudo nano /etc/hosts

Verify that the entry for 127.0.0.1 localhost exists. Sometimes, system updates reset this file or add conflicting entries.

A more robust solution for development on macOS Yosemite and later is to use a local Docker environment or a dedicated PHP-FPM setup with Nginx, which isolates your application from the system's default Apache configuration. This avoids the headache of managing httpd.conf manually when Apple changes its internal library structure.

If you are committed to using the system Apache, you may need to manually edit /etc/apache2/httpd.conf. Look for lines loading modules and ensure they point to the correct paths in Yosemite, typically found under /usr/libexec/apache2/. You might need to comment out entire sections of LoadModule directives and replace them with versions compatible with the new OS.

Remember that MySQL persistence is separate from the web server. If your database was running on Mavericks but stopped after the upgrade, check the launch daemon files in /Library/LaunchDaemons/. The system update may have moved or altered these plist files, preventing the service from starting automatically at boot.

Ultimately, relying on the default Apache installation from a major OS point release can be risky for development workflows. Consider using a version manager like Homebrew to install your own version of Apache or switch to Nginx/PHP-FPM for better compatibility and easier configuration management.

Our network