Fill these in once
- Add the lineNeeds sudo
echo "127.0.0.1 myapp.test" | sudo tee -a /etc/hosts - Make your Mac notice the changeNeeds sudo
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Check it worked
- Check the name points to the right place
ping -c 1 myapp.test
Undo it
- Remove the lineNeeds sudo
sudo sed -i '' '/ myapp.test$/d' /etc/hosts
- Add the lineNeeds sudo
echo "127.0.0.1 myapp.test" | sudo tee -a /etc/hosts
Check it worked
- Check the name points to the right place
getent hosts myapp.test
Undo it
- Remove the lineNeeds sudo
sudo sed -i '/ myapp.test$/d' /etc/hosts
- Add the lineRun as administrator
Add-Content -Path "$env:windir\System32\drivers\etc\hosts" -Value "127.0.0.1 myapp.test" - Make Windows notice the change
ipconfig /flushdns
Check it worked
- Check the name points to the right place
Resolve-DnsName myapp.test
Undo it
- Remove the lineRun as administrator
(Get-Content "$env:windir\System32\drivers\etc\hosts") | Where-Object { $_ -notmatch ' myapp.test$' } | Set-Content "$env:windir\System32\drivers\etc\hosts"

New to DNS? I explain it in plain English on Layman Terms.