일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- C/C++
- crashlog
- phpmailer
- 와이브로
- plcrashreporter
- .net
- 데이터 전달
- net
- GDI
- protobuf-c
- 자바스크립트
- self-signed ssl
- M8200
- MFC
- 한 번만 실행
- Font
- PDA
- JavaScript
- docker
- API
- 설치제거
- Antialiasing
- VS2008
- 블루투스 헤드셋
- 크래시로그
- C#
- php
- 기념일관리
- EUC-KR
- ClickOnce
- Today
- Total
~☆~ 우하하!!~ 개발블로그
How to edit the hosts file in Mac OS X – Leopard 본문
How to edit the hosts file in Mac OS X – Leopard
April 6, 2009 by decoding
Introduction
The hosts file is a text file that maps hostnames to IP addresses.
Upon typing a url address on the browser, the system is checking if
there is a relevant entry on the hosts file and gets the corresponding
IP address, else it resolves the IP via the active connection’s DNS
servers.
The hosts file can be edited to block certain hostnames (like ad-serving/malicious hosts), or used for web development purposes, i.e. to redirect domains to local addresses.
Editing the hosts file
Editing the hosts file in Mac OS X – Leopard, is a pretty easy task, especially if you are familiar with the terminal.
Step 1 – Open the Terminal.app
Either by start typing Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.
Step 2 – Open the hosts file
Open the hosts by typing on the Terminal that you have just opened:
1 |
$ sudo nano / private / etc / hosts |
Type your user password when prompted.
Step 3 – Edit the hosts file
The hosts file contains some comments (lines starting with the #
symbol), as well as some default hostname mappings (e.g. 127.0.0.1 –
localhost).
Simply append your new mappings underneath the default ones. Or edit one of the default values if you know what you are doing!
You can navigate the file using the arrow keys.
Step 4 – Save the hosts file
When done editing the hosts file, press control-o to save the file.
Press enter on the filename prompt, and control-x to exit the editor.
Step 5 – Flush the DNS cache
On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:
1 |
$ dscacheutil - flushcache |
You can now test your new mapping on the browser!
'macOS' 카테고리의 다른 글
windows os style 단축키 in macOS (and Vmware in macOS) (0) | 2020.02.08 |
---|---|
전화번호(핸드폰)에 +82 국가코드 붙이는 스크립트 (0) | 2017.12.27 |
최고의 Mac용 subversion client 프로그램을 찾아라! (0) | 2011.08.02 |
MacOS 에서도 Shift + Space 로 한영전환하자. (0) | 2009.11.25 |
해킨토시 10.5.7 로 업데이트 성공 (0) | 2009.06.15 |