Then this day came - i had to edit my hosts file on the mac for making some program work. It was pretty easy in the windows - just go to a folder deep inside the Windows/system32/drivers, open the hosts file as an administrator and make your edits. Replace the existing file with the newly modified file!
But then it was more easier on the mac until i used the terminal commands - this is what i did:
- Open terminal
- Type in - sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts
- The terminal shall ask for password - enter your password
- The hosts file will open in TextEdit
- Ad your entries between localhost and broadcasthost
- Save file using command + s key combination
- Close the file, Quit the textedit app
- Execute this command in terminal - sudo dscacheutil -flushcache
You are all set! Isn't it so easy :) I love this command line usage. It reminds me of my college days!
Happy editing your hosts file.
If you have any other simple tricks that one might need on mac, do share with me. Thanks for reading this post!