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 have a server running at port 4433 on my localhost machine. I'd like to refer to the service as http://mytest.com:4433 from the browser or any script that I write. How could I set the DNS on OSX to do this? Thanks!

share|improve this question

1 Answer 1

You could add a new line in your hosts file (see man hosts(5)). The easiest that I know of would be to open a Terminal and use nano to edit the file. You could type this in your terminal:

sudo nano /etc/hosts

(replace nano by vi if you are more familiar with the latter). Then go at the end of the file and add something like this:

127.0.0.1    mytest.com

Save the file (key combination for nano is (it's a o upper case): Ctrl + O).

The file hosts is read by mDNSResponder which is the local DNS cache on OS X (incl. Snow Leopard). So your browser will be redirected to the IP you set in the file.

share|improve this answer

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.