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!


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:    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.

You must log in to answer this question.