Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Not working in 10.7.2 #14

linuslundahl opened this Issue · 38 comments

23 participants

Linus Lundahl Simon Gate Bo Jeanes sushicodeur Piotr Banasik chrism2671 Nick Bohlen Anton Lindqvist Chris Mar Sam Granieri Jack Bewley Bert Goethals Duncan Beevers Lee Jensen Chris Adams Matthew Fallshaw Thomas Boerger Wojtek Kruszewski Jared Jones Lars Fronius Joel "The Merciless" Meador Finn Smith scshaw
Linus Lundahl

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

Simon Gate

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

Bo Jeanes

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.

Simon Gate

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!

Piotr Banasik

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 ;)

Simon Gate

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.

Nick Bohlen

same issue with me: 10.7.2.

Anton Lindqvist

Same issue with 10.7.2.

Chris Mar

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

Sam Granieri

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

Jack Bewley

Same issue here.

Bert Goethals

same here

Bo Jeanes
Duncan Beevers

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.

Lee Jensen

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

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

Bo Jeanes
Chris Adams

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?

Lee Jensen

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.

Bo Jeanes
Duncan Beevers

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.

Matthew Fallshaw

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?

Bo Jeanes

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
  [Adding] ->
$ ping
PING ( 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
--- 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.

Bo Jeanes bjeanes closed this
Bo Jeanes bjeanes was assigned
Bo Jeanes

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

Bo Jeanes

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.

Bo Jeanes bjeanes reopened this
Duncan Beevers

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?

Thomas Boerger

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

Wojtek Kruszewski

Same here (10.7.2, worked on Snow Leopard)

Jared Jones

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
Lars Fronius LarsFronius referenced this issue from a commit in Jimdo/ghost
Lars Fronius LarsFronius 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
Lars Fronius

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.

Bo Jeanes

Fixed with pull requst #18

Bo Jeanes bjeanes closed this
Joel "The Merciless" Meador

Rev the gem version?

Bo Jeanes

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

Joel "The Merciless" Meador


Bo Jeanes

I wonder if this is related: 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 Smith

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 Smith finn referenced this issue from a commit in finn/ghost
Finn Smith finn Fix for issue #14 on Mountain Lion.
Uses /etc/hosts if equal or greater than 10.8.
Bo Jeanes

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
Something went wrong with that request. Please try again.