Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I've setup a chroot for my PHP server running behind nginx on mac.

It works except for any call to a CURL request fails with an error like cURL resource: Resource id #43; cURL error: Couldn't resolve host 's3.amazonaws.com'

Most guides to setting up a chroot environment say that you should map certain files to be available inside the chroot. The only file I can't find to map is /etc/nsswitch.conf which apparently doesn't exist on Mac.

What is the equivalent file on a Mac? Or what file/socket should be made available to the chroot environment to allow DNS lookups to work?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

It turns out that on OSX the DNS lookup is done through the service mDNSResponder service which is running as a socket at /var/run/mDNSResponder.

It does not use /etc/nsswitch.conf or /etc/resolv.conf so there is no way of mapping those files into a chroot. Instead it's a better idea to use a localhost proxy.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.