Never done it personally, but google seems to suggest it’s fairly simple. :)
https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=android%20edit%20hosts%20file
The procedure for editing the hosts file in Mac is here: https://www.ihash.eu/2015/09/how-to-edit-hosts-file-in-mac-os-x-10-11-el-capitan/