opfsuite.blogg.se

How to edit a file on mac
How to edit a file on mac










how to edit a file on mac how to edit a file on mac

  • When you drop the hosts file back in its original location, macOS will ask you what to do about the unmodified hosts file that’s already there.
  • If you’ve closed the Finder window pointing to this directory, simply use the Finder > Go > Go to Folder option, discussed above, to reopen it.
  • Then, drag and drop the hosts file from your Desktop back to its original location at /private/etc.
  • Once you’ve made your desired changes to the hosts file, save it in its current location on the Desktop.
  • You can add as many entries to the hosts file as you wish by entering new mappings on each line.
  • If we map that to Facebook in our hosts file, any time someone using the Mac tries to go to Facebook, they’ll see The New York Times load instead.

    how to edit a file on mac

    For example, The New York Times website returns an IP address of 170.149.172.130. Make note of the IP address that’s returned and use it in your Mac hosts file mapping.

    how to edit a file on mac

    Note: The + short option keeps the output to just the information we need, which is the IP address.Open up terminal and type “ $ dig + short 104.25.27.105“.To dig the site via Terminal, we simply open up Terminal and then run the dig command on URL, which will then return the IP address as output. To determine a website’s IP address, you can use the dig command, which comes standard with macOS. In our case, we want to block Facebook so we’ll map to 0.0.0.0 which, as an invalid IP address, which will result in an error.Īlternatively, you can enter the IP address of a valid site instead of 0.0.0.0, which will result in users attempting to access Facebook being directed to the site of your choosing.To do this, type the IP address you wish to assign, followed by two tabs and the hostname.In our example, we’ll pretend that the computer we’re using is a device that we want to use exclusively for work, not allowing ourselves to get distracted by Facebook on our work machine. In addition to testing newly developed websites and web hosting migrations, another reason to edit the hosts file is to block access to specific websites. To edit the file, you’ll add your own lines after broadcasthost. It also contains default IP values for localhost and broadcasthost. For each line, any text after the pound sign is ignored by the computer, making it a good way to add notes and descriptions to your files. Any line that starts with a # sign is a comment and is not read by the /etc/hosts file.












    How to edit a file on mac