Last Updated: February 25, 2016
· franklouwers

Learn about AlwaysAppendSearchDomains in OSX (Mountain) Lion

You all know that when you define your own domain as "", and you want to ping a host called "", you can just use the (non-qualified) hostname "mailbox". Eg: ssh mailbox

If you have a host called, weather or not you can use "web01.production" as a shortname depends on how your operating system is configured.

In Mac OSX (Mountain) Lion, the shortcut won't work. If the hostname you try to use has a . in it, OSX will always assume it's a FQDN (fully qualified domain name), and won't try to append your default search domain.

There is a way to change this behaviour, and involves changing a .plist file, so be sure to have a backup before you make any changes...

Here we go:

1) Backup /System/Library/LaunchDaemons/

sudo cp /System/Library/LaunchDaemons/ ~/

2) Edit mDNSResponder.plist to include the "-AlwaysAppendSearchDomains" setting. You can use any text editor you like, just don't forget to invoke it via sudo. If you know vi(m), that's probably the easiest way:

sudo vim /System/Library/LaunchDaemons/

3) You need to add <string>-AlwaysAppendSearchDomains</string> to the ProgramArguments array. In my copy, it was around line 16. Eg:


4) Reload the mDNSResonder service:

sudo launchctl unload -w /System/Library/LaunchDaemons/

sudo launchctl load -w /System/Library/LaunchDaemons/

4 Responses
Add your response

awesome. thank you for posting this.

over 1 year ago ·

I've put together a shell script to automate the fix (and an uninstaller if you need it later), here:

This was to give out to less-technical users at work that might shy away from manually editing system files.

over 1 year ago ·

I have noticed weird behavior in some apps since turning this on. mysteriously can't connect to some of my accounts after waking my laptop (haven't verified that it's 100% of the time yet), yet if I quit and restart it finds them fine. MacIrssi has a similar issue with the IRC servers I have configured to auto-connect. Neither of these things happened before.

I don't see anything in the logs, and I haven't done a packet trace yet. Just putting it out there in case others have had any weird connection issues using this fix.

[Edit: Almost forgot: The hosts it fails to connect to in the above examples are not in domains which are in my search list, and all are specified by FQDN. Oddly enough it seems like this -doesn't- affect hosts which are in my search list (even though they are specified by FQDN as well.]

over 1 year ago ·

What's the "-launchd" for? I'm running Mavericks and /System/Library/LaunchDaemons/ doesn't include "-launchd". Should I add it?

over 1 year ago ·