Fix a Slow Website Due to a .local Hostname on Mac OS

Fix a Slow Website Due to a .local Hostname on Mac OS

In the past I’ve always setup my local development websites to utilize a .local hostname. (i.e., daharveyjr.local). Once I switched to utilizing a Mac for development, I noticed that my websites seemed to load extremely slow when running on my local MAMP installation. It always drove me crazy, but recently I discovered why it’s so slow, and found a way to resolve the issue.

In short, the Mac OS identifies .local hostnames as being a part of Bonjour. (Bonjour is a Apple’s implementation of zero-configuration networking. If interested in learning more, you can read about it here, but it’s not required: Bonjour). On Mac OS, when you attempt to call a .local hostname, there appears to be a significant internal battle before it realizes how it should be handling the hostname.

To avoid this issue, the easiest thing to do is to NOT use a .local hostname. For my own purposes, I switched to leveraging a .dev hostname. (i.e., my full hostname for the local development website for this website is daharveyjr.dev).

Keep in mind, when working with a WordPress based website, you’ll also need to update the ‘siteurl’ and ‘home’ options with the new hostname within the wp_options table. I executed the following SQL to properly record the change in hostname to my local wordpress website.

-- Update 'home' and 'siteurl' Option Values
UPDATE wp_options SET option_value = 'http://daharveyjr.dev/' WHERE option_name IN ('home', 'siteurl');

There you have it! Enjoy a faster local MAMP website!

Author: daharveyjr

I’m a solution architect responsible for the design, development, implementation, testing, and maintenance of e-commerce operations and applications using the Hybris and WebSphere Commerce product suites and other web technologies such as Java, J2EE/JEE, Spring, PHP, WordPress and more. Twitter | Facebook | LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *