Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am developing on my local machine and I need to have a browser run on one host file and another browser run on a different host file.

One browser would run a host file to redirect domain.com to my local machine. The second browser would run a host file to redirect domain.com to a external product server.

Is this possible?

Btw, I can't rename the local machine to lets say this.domain.com

I'm running mac os x

share|improve this question
add comment

migrated from serverfault.com May 23 '11 at 10:33

This question came from our site for professional system and network administrators.

1 Answer

Caveat: I know many Unices, but not Darwin/MacOS Xvery well, so some of the details may differ...

You have a few options to achieve your aim, though not necessarily by the method you describe:

  • run a virtual machine for the second browser
  • run a 'virtualised applcation' for the second browser (I do not know what, if any, application-virtualisation options exist for MacOS X)
  • run a second browser in a chrooted environment, though you would need to populate the chroot with a lot of bits of the OS for something like a graphical browser to run
  • configure one browser to use a proxy running on another machine which has different lookup information
  • hook something which alters the response of a gethostbyname() call, e.g. LD_PRELOAD=/my/special/libresolv.so /path/to/browser (the browser, like any other application does not, AIUI, read /etc/hosts directly, instead it calls gethostbyname() which is handled by libresolv which will read /etc/hosts or talk to DNS servers or other name-lookup facilities)

There might be 'sandboxed' browsers for MacOS X, usually intended for security however they might be based on an abstraction layer between browser and OS that gives you a useful starting point.

share|improve this answer
    
+1 for running a virtual machine with the second browser. I actually find it useful to have a virtual machine running the exact same setup as the live machine so I'm sure it will work in both places. –  Scott Warren May 23 '11 at 12:15
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.