Edit hosts file on OSX

  05/06/2017

I had to modify local hosts file on OSX many times and it’s not just about edit and save because it requires few more things before and after.

To properly edit the hosts file on OSX, first you need to get super user access, then to remove protection from hosts file with chflags, edit hosts file and save, flush DNS cache (optional), and to set back the hosts file as protected (otherwise it will not work).

sudo su –
chflags nouchg /private/etc/hosts
sudo nano /private/etc/hosts
sudo killall -HUP mDNSResponder
chflags uchg /private/etc/hosts


Weather Forecast – Belgrade

24/09
Fri
weather - icon
Clouds
19°C
25/09
Sat
weather - icon
Clear
24°C
26/09
Sun
weather - icon
Clear
25°C
27/09
Mon
weather - icon
Rain
26°C
28/09
Tue
weather - icon
Rain
17°C
29/09
Wed
weather - icon
Clouds
19°C
30/09
Thu
weather - icon
Clouds
19°C

Powered by OpenWeatherMap | by Phee

RSS Laracasts

  • Setting Up Nginx 21/09/2021
    Now we can begin building out what we'll use to run any Laravel application. First thing's first:...
    Jeffrey Way
  • From PHPUnit to Pest 17/09/2021
    Pest is a wrapper around PHPUnit that's all about removing distractions and simplifying your tests as much...
    Jeffrey Way
  • What is Docker 17/09/2021
    Let’s start at the very beginning. We’ll discover what Docker is and why containers are so popular....
    Jeffrey Way
  • Create a Simple Dockerfile 17/09/2021
    We’ve seen how to use ready-made images, but what about creating one of our own? After writing...
    Jeffrey Way
  • Continuous Integration Testing 15/09/2021
    Next up, let’s move on to an approach known as Continuous Integration (CI). This approach was rather...
    Jeffrey Way