Friday, April 11, 2014

Editing the hosts file on a Mac

Sometime you need to test your application with URLs other than localhost.  In my case i needed to test  a Twitter oauth authentication callback and wanted to debug it on my localhost.  On Twitter i set my callback URL to http://test.mydomain.com.

On my mac, i had to change my hosts file to let my mac pretend it was test.mydomain.com.

Type this on the terminal:

sudo nano /private/etc/hosts

Add this line:

127.0.0.1   test.mydomain.com

That's it!

No comments:

Post a Comment