0

Unlike Linux, we cannot use HOSTALIASES env var. I believe it is possible to make a process see a different hosts file if I put it in a chroot jail, but I don't want to have to do that for this process. Is there another way to do this in macOS?

  • Does it need to be native? What about using a Docker contained app instead? – slm Apr 17 at 3:05
  • I'm not sure what you want to accomplish in the end, but have you considered using dnsmasq? See e.g. here – Asmus Apr 17 at 10:50
  • @Asmus do you know if there is a way to restrict dnsmasq to only be visible to a single process? E.g. process A uses the normal hosts file, but process B uses what is in dnsmasq? – Andrew Apr 17 at 17:05
  • Hmm, I'm not sure; macOS tends to be very odd about DNS lookups :-/. Could you given a specific example for such a process (terminal command / app / webtraffic)? – Asmus Apr 17 at 18:23
  • Addendum: would it be a problem to reroute the traffic on a per-use basis (i.e. switching to a different DNS configuration only while using this process)? Or would it need to be permanent? – Asmus Apr 17 at 18:30

You must log in to answer this question.

Browse other questions tagged .