Host setting method in Mac

Source: Internet
Author: User

At development time, the general data test is in the test environment, this is the need to set the host to point to the test database; Below I recorded three methods, also seen on the Internet, take notes here.

1. Edit Host via VI

Here's how:

(a) Open the terminal and enter the following command:

sudo vi/etc/hosts

(b) Enter the password (login to the computer password)

(c) Some data will be displayed at the terminal, about host introduction, and if the last line is displayed as more, press ENTER to see some editing commands;

respectively: Open edit recover Delete quit;

Enter E, enter the editor, enter the edit interface, input I to insert, after the insertion, press ESC, and then enter: Wq to save;

2. Edit host via Nano

The method is similar to the above and runs in the terminal:

sudo nano/etc/hosts

The same is to enter the password, open the Hosts file, according to your needs to edit the file, after editing, press Ctrl+o save, the file Name to Write:/etc/hosts, press ENTER to confirm, and then press Ctrl+x exit.

3. Modify in the graphical interface

Open the Finder, and then click on the menu bar to go-to the folder (or shortcut shift+command+g), enter/private in the path, after entering the ETC folder right-click-Show Introduction, in the folder Introduction window at the bottom of the "Share and Permissions", Change the permissions of everyone to read and write, and if you find that you cannot modify it, you can modify it by unlocking the small lock in the lower right corner.

After modifying the permissions of the ETC folder, then enter the ETC folder, modify the permissions named Hosts file (same as everyone read and write), after the modification, you can directly in the Hosts file right-click, through the "text edit" to open and edit the file, No prompt will appear without permission. After modifying and saving, remember to restore the file and the permissions of the ETC folder.

The next three ways I have verified, in the latest system can be used!

Host setting method in Mac

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.