Four methods of modifying hosts file in Mac OS System

It ’ s not easy for Mac users to use “ planck’s constant oxygen deoxythymidine monophosphate ” to edit the file appoint barely because they don ’ t have permission to search the file system on the Internet. consequently, it ’ s not easy for my friends to use “ hosts ” to edit the file name on the Mac. Therefore, with this tip, I contribution four methods to modify the hosts file in the Mac OS X leo system. These four methods do not appear permission prompt, and Mac OS X Snow Leopard ( 10.6 ) users can besides use these methods .
1. Modify via VI editor

Open the end ( Application – utility ) and run :

Copy code

The code is as follows : sudo united states virgin islands /etc/hosts
You will be prompted to enter your password on the screen ( no characters will be displayed when entering the password, flush * will not be displayed, and press embark after entering ). After opening the hosts file, press I to enter the interpolation mode ( which can be understood as editing mood ), and then edit the file according to your needs. After editing, weigh ESC to exit the insertion manner, and then iron : WQ + enter to save and exit, Remember to enter the colon in English .
This is the method acting the author has been using. The VI editor should not be unfamiliar to users who much use Linux, and the editor is built into the MAC system by nonpayment. however, for users who have not used VI, it very takes a while to learn its basic custom. In addition, VI editor program is a very good and powerful creature. If you want to play MAC well, you ’ d better master the practice of this creature .
2. Using the nano editor
like to the above method acting, this editor is simpler and easier to use than VI, but it is not mighty and seems not vitamin a popular as VI. The method acting is besides to run in the terminal :

Copy code

The code is as follows : sudo nano /etc/hosts

similarly, enter the password, open the hosts file, and edit the file according to your needs. After editing, imperativeness Ctrl + O to save. When file diagnose to write : / etc / hosts appears, press insert to confirm, and then bid Ctrl + X to exit .
3. Merge files using cat command
This method acting is more desirable when you want to add some contentedness to the hosts charge. First, you need to save the contentedness to be added to the hosts file as a TXT text file ( it is recommended to save it directly in your drug user directory ). I ’ ll take 123 saved in the exploiter directory hera Txt as an exemplar .
similarly, start the terminal, and then run the follow two commands :

Copy code

The code is as follows : sudo -s
caterpillar ~/123.txt > > /etc/hosts
By the way, the ~ symbol represents the drug user directory of the current drug user in MAC and even all UNIX and Linux based systems Represents the current directory. This time you should understand why ~ / 123 is in the above command Forget it .
4. Modify directly in the graphical interface

Open the finder, then click go – go to folder ( or the shortcut key shift key + Command + G ) in the menu bar, enroll / private in the path, and then right-click the etc folder to display the profile. Find “ share and permission ” at the bottom of the booklet visibility window, and modify everyone ’ s permission to “ read and write ”. If you find that it can not be modified, Unlock the small lock in the lower correct corner and you can modify it .
After modifying the permissions of the etc booklet, go under the etc folder and modify the permissions of the charge named hosts ( besides everyone read and writing ). After the alteration, you can right-click the hosts file immediately, open and edit the file through “ text editing ”, and there will be no immediate of no permissions. After modifying and saving, remember to restore the permissions of the file and the etc folder.

Last words
These methods of modifying hosts under leo organization shared in this article will not appear the prompt without file change license. In fact, this motivate is besides the performance of leo ’ sulfur higher security system. The above methods can be used in 10.6 system. At least they can be regarded as the simplest methods of modifying hosts files under lion system. In summation, you can see that the above three methods need to be operated in the end, which may be identical troublesome for users who have precisely used Mac and have not played Linux. In fact, the end is very simple. Is it fair a few commands, and the function is very herculean, which can realize many unexpected functions. consequently, for students who good use Mac, they must not be intimidated by the command-line operation of the terminal. Basically, you fair need to copy the dominate, paste it in and crusade figure. What ’ s the difficulty ?

Leave a Reply

Your email address will not be published.