Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Not working in 10.7.2 #14

linuslundahl opened this Issue Oct 13, 2011 · 38 comments


None yet

Can't get ghost to work at all in the latest Lion update...

smgt commented Oct 13, 2011

Me neither. Seems Lion don't look into directory service when resolving hosts.


bjeanes commented Oct 13, 2011

Interesting... ill try to update today and see what's going on.
On Oct 13, 2011 1:37 AM, "Linus Lundahl" <

Can't get ghost to work at all in the latest Lion update...

Reply to this email directly or view it on GitHub:

Good to see I'm not alone and the problem seems to be with 10.7.2 :/

I've tried many thing like deleting all domains, recreating them... nothing works anymore (I miss my local domains :).

Thanks for the great work, hope you can do something.

smgt commented Oct 13, 2011

If you need them now (like I do) you can add them to /etc/hosts again. But then you get a sweet 5 sec delay before each lookup! UGH!

piotrb commented Oct 14, 2011

5 sec delay? not sure what's up with that .. I didn't experience it myself.

But yea .. require 'ghost/linux-host' is the workaround on mac for now.

On a good note trying to troubleshoot directory hosts not working I stumbled upon ghost .. thanks for creating the lib ;)

smgt commented Oct 14, 2011

Its only the local tld that has a delay. Bonjour is higher ranked than host file.

I had the same problem with 10.7.2.

nbohlen commented Oct 14, 2011

same issue with me: 10.7.2.

mptre commented Oct 15, 2011

Same issue with 10.7.2.

cmar commented Oct 17, 2011

glad to see other people had the same issue. 10.7.2 not working at all

$ ghost add store1.local
[Adding] store1.local ->
$ dig store1.local

; <<>> DiG 9.7.3-P3 <<>> store1.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 45359
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;store1.local. IN A

;; Query time: 3 msec
;; WHEN: Mon Oct 17 13:31:43 2011
;; MSG SIZE rcvd: 30

I had the same problem too. I switched to etc hosts...

Same issue here.

Bertg commented Oct 20, 2011

same here


bjeanes commented Oct 20, 2011

All, I don't need further confirmation. I know the issue exists and ill try
to find the time over the weekend to see what the root cause is and if it is
fixable from my end.
On Oct 20, 2011 7:05 AM, "Bert Goethals" <

same here

Reply to this email directly or view it on GitHub:
#14 (comment)


duncanbeevers commented Oct 21, 2011

I just want to let people experiencing this issue know that rather than "me too"ing this, you can track the issue by clicking "Enable notifications for this issue" near the bottom of the page.


outerim commented Oct 31, 2011

Unfortunately I don't think this issue is specific to ghost, see:

It appears we'll have to wait on apple for a fix.


bjeanes commented Nov 1, 2011

Yes that is correct. This is a problem with OS X, not Ghost. However, ghost could work around this by forcing itself into "linux" mode when on 10.7.2.

Unfortunately, I have not managed to find the time to do this yet. Patches are certainly welcome and I'll be happy to push out a new gem if someone steps up.

I was up for giving this a go, until I read this section here in the link on ehmac that outerim mentioned

As a stop-gap, I've stuffed everything into /etc/hosts for now and it works system-wide. But I'd rather not do that. I hate touching stuff in /etc because of the critical nature of it all (one wrong typo in /etc/hosts, and your machine doesn't boot because it can't resolve to localhost...).

Is this really the case?

Can a badly patched ghost could stop your mac booting if forcing it to update the /etc/hosts file?


outerim commented Nov 2, 2011

I'm not entirely sure about that myself. I've been using /etc/hosts (as have others I'm sure) as a workaround to the dscl problems and haven't had any issues rebooting (yet). This is the contents of the hosts file pre ghost:
::1 localhost

And this is the contents after: broadcasthost localhost MYMACHINE.local

The entry mentioning loopback is gone which is a bit troubling as there is a comment in the file mentioning not to remove that entry but as yet I haven't experienced any issues.


bjeanes commented Nov 2, 2011

Hmm, that may be due to some validation that is discarding ipv6
addresses... can you add a bug?


duncanbeevers commented Nov 2, 2011

I saw a fork of ghost that wrapped the ghost-managed portion of the hosts file in a set of sigils. This seems like a reasonable approach.

This didn't work for me, but looks very relevant:
"It appears that Multicast DNS (mDNS), which is used in Apple’s Bonjuor for network discovery without a tradition DNS Server, has the Top Level Domain .local reserved for special mDNS functionality. Mac OS X will treat domains ending with .local differently! Use another TLD, like .dev, and it will work correctly."

Can someone else give this a try?


bjeanes commented Nov 12, 2011

Thanks for that link @matthewfallshaw. From my testing locally, this is in fact the exact reason ghost seems not to work.

As you can see below, I am on 10.7.2 and ghost works perfectly for me for non-.local TLD domains.

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.7.2
BuildVersion:   11C74
$ ghost list
Listing 0 host(s):
$ ghost add foo.dev
  [Adding] foo.dev ->
$ ping foo.dev
PING foo.dev ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=0.073 ms
64 bytes from icmp_seq=1 ttl=64 time=0.122 ms
--- foo.dev ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.073/0.098/0.122/0.024 ms
$ ghost add foo.local
  [Adding] foo.local ->
$ ping foo.local
ping: cannot resolve foo.local: Unknown host

Since this is something that Apple decided to change about mDNS and ghost is in fact still useable with any other TLD, I'm going to close this issue. I'm not opposed to someone sending a pull request for forcing the use of /etc/hosts on OS X if using .local TLDs is essential to them, but I am not convinced it's necessary.

@bjeanes bjeanes closed this Nov 12, 2011

@ghost ghost assigned bjeanes Nov 12, 2011


bjeanes commented Nov 12, 2011

FWIW, forcing the use of /etc/hosts may still be necessary to fix #7


bjeanes commented Nov 12, 2011

Yikes. Turns out that was a false positive. pow was hijacking look ups for .dev. I tried with different TLDs and I still couldn't ping anything.

@bjeanes bjeanes reopened this Nov 12, 2011


duncanbeevers commented Nov 13, 2011

I've done some work toward this but the main sticking point for me is that the /etc/hosts strategy requires escalation of privileges of the process calling ghost. The old strategy backticked-out to the system, allowing only that process to receive escalated privileges.

Is this an issue for anyone else?

I think browsers doesnt respect the dscl stuff. I have added a dev.foo.com domain, pinging works fine, but the browser (Chrome, Firefox, Safari) dont like this entry. Before there were only problems with Safari.

Same here (10.7.2, worked on Snow Leopard)

If you've already created your dscl entries, here's a one-liner to get your entries into a format ready for /etc/hosts:

echo " `ghost list | tail -n+2 | awk '{print $1}' | tr '\n' ' '`"

EDIT: Resolution seems to take a while if you have a lot of hosts on one line, so you can do this to create a list of them line-by-line:

for i in $(ghost list | tail -n+2 | awk '{print $1}'); do echo " $i"; done

@LarsFronius LarsFronius pushed a commit to Jimdo/ghost that referenced this issue Apr 5, 2012

Lars Fronius Fix for issue #14 in bjeanes/ghost.
Looks up Mac OS X Version and uses /etc/hosts if equal or greater than 10.7.2

LarsFronius commented Apr 5, 2012

Well, this is a quick hack to use /etc/hosts if Mac OS X Version is 10.7.2 or greater. The regex should be adjusted when Apple releases a fix.

@bjeanes bjeanes added a commit that referenced this issue Apr 6, 2012

@bjeanes bjeanes Merge pull request #18 from Jimdo/master
Fix for issue #14 in bjeanes/ghost

bjeanes commented Apr 6, 2012

Fixed with pull requst #18

@bjeanes bjeanes closed this Apr 6, 2012

janxious commented Apr 8, 2012

Rev the gem version?


bjeanes commented Apr 8, 2012

Soon. There's another small bug I want to attend to first

janxious commented Apr 9, 2012



bjeanes commented Aug 8, 2012

I wonder if this is related: http://hints.macworld.com/article.php?story=20120808001623238. I use the 10.5 and 10.6 way of flushing DNS after making changes, but perhaps we need to do be a bit smarter...


finn commented Aug 16, 2012

It should be straightforward enough to just check the version and do either

dscacheutil -flushcache


killall -HUP mDNSResponder

depending on the version of Mac OS X. (sudo is definitely needed for the latter to work.)

@finn finn added a commit to finn/ghost that referenced this issue Aug 16, 2012

@finn finn Fix for issue #14 on Mountain Lion.
Uses /etc/hosts if equal or greater than 10.8.

bjeanes commented Aug 16, 2012

Yup. I just need to set aside some time to confirm that this is even the cause of the problem.

@bjeanes bjeanes added a commit that referenced this issue Aug 21, 2012

@bjeanes bjeanes Merge pull request #31 from finn/master
Fix for issue #14 version checking on Mountain Lion.

scshaw commented Aug 24, 2012

Had similar issue with hosts in Lion and came across this bit of info: (source unknown)

If you are used to adding lines like the below in OS X previous to Lion local test-app

to the end of the file, then it might throw you off a little bit as it seems you now have to have them above this line

fe80::1%lo0 localhost

Have been following this advice with Lion, and with Mountain Lion, with no problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment