Usually, you’d do something like that by editing the /etc/hosts file on a Mac and then you’d be good to go.
However, I’m not sure when, if it was with Lion (10.7) or the recent 10.7.2 update, lots of people started to have problems with their hosts file, as if it was being ignored. Myself included.
Going into terminal and typing:
… would indicate that the first resolver was actually the DNS server, and your local resolver came only 2nd, so Apple might have changed the resolve order, so your hosts file is no longer 1st priority.
One workaround suggested on the Internet was to install DNSMasq and run your own local DNS server based on your hosts file. That’s of course a possibility, but the whole installation process sounds complicated to me, and I’d rather avoid running a local DNS server if possible, considering that it should work with just the hosts file, and it used to.
So, after hours of googling around, searching and reading, I came upon this post, which suggests to run this command in Terminal:
hexdump -C /etc/hosts
… to confirm that your /etc/hosts file has Unix style line endings. I had no idea how to interpret the result, but it gave me an idea: To check if I’m actually saving the file with Unix style line endings or not.
Back into Terminal, I wrote the following:
sudo edit /etc/hosts
Which launched TextWrangler (free text editor for Mac, get if you don’t already have it), and I saw that it had selected “Windows (CRLF)” line endings. I simply changed it to “Unix (LF)”, as you can see on the screenshot below which shows a standard /etc/hosts file. I saved the file – and that’s it, the host files now works again!!
I also tried, in Terminal, to write:
… which of course gave me an IP address belonging to Google. Then I added this line to my hosts file:
And I ran the ping command again, and ping would now tell me that google.com points to 127.0.0.1. It works!
And yes, if you’re one of those bad people who didn’t bother paying for Photoshop, I believe this will also fix your “127.0.0.1 activate.adobe.com” stuff. If this helps, you can repay me by purchasing a legal license for your Photoshop
Related articles you might find interesting:
- Fixed: Copy/Pasting E-mail Address In Snow Leopard Mail
- iTunes Ping reaches 1 million users in 2 days
- How To: QuickTime X Autoplay Movies On Open In Snow Leopard
- iTunes 10: Left navigation gray and dull, close/minimize/maximize buttons vertical?! [How-to fix]
- Aperture 3 Performance Fix – Make Slow Aperture Run Faster