Five methods: Modify the hosts file on the Mac System

Source: Internet
Author: User

Title: three methods to change the hosts file under Mac OS X

As we all know, many websites are now blocked by kung fu walls, such as Twitter and Facebook.
We often see that the IP address and website name are added to the hosts file of the system. In Windows, many
I know, but I don't know about Google. It's difficult to change the hosts file in the MAC system.
There are three methods to explore and search:

1. Terminal change
This seems to be the most widely used method on the Internet.
Open the terminal in the application, and enter
Sudo VI/etc/hosts
Then prompt to enter the system password
The hosts file is automatically opened.
Enter I
Enter edit mode
Copy the added website and IP address
After editing, Press ESC and enter: WQ
This completes the change.

2. Modify hostswidget
There is a hostswidget in Mac, which can be operated without using the [terminal] tool for convenience.
After entering the password, you can add it. You cannot copy it. It is troublesome to add one by one.
(Remove space): www. Apple. com/downloads/dashboard/networking _ Security

3. directly modify the local file
I figured it out myself.
Open the finder and choose to go to the folder (shortcut: Shift + command + G)
In the pop-up box, enter etc and go to the etc directory, find the hosts file, open (edit in text), copy or edit it, and save it.
You may be prompted that the file cannot be saved because of permission issues. open the introduction to the hosts file, which contains the share and permission column. Click the lock in the lower right corner and enter the password to change the permission. change your user permissions to read and write.
If a permission error is prompted, You need to modify the permissions of the two folders "etc" and "private" in the parent directory. The methods are the same and both are read and write.
After the hosts file is saved, change the permission back.





* The following methods can be used to follow the post below:


1. Start the root account and change it directly

* Recommended (this method is very useful in my own experiments)

2. Open the terminal and enter sudo/applications/textedit. APP/contents/MACOs/textedit/etc/hosts to edit the hosts in text.


Reprinted from: http://www.yici.net/content/text_all/text_0/628_1.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.