MacでHostsファイルを編集する方法
インフラエンジニアの伊藤です。
MacでHostsファイルを編集する方法です。
1 | # sudo vi /private/etc/hosts |
デフォルトのhostsファイルがこちら。
1 2 3 4 5 6 7 8 9 | ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost |
一番下に同じ形式で追加しましょう。
1 | 127.0.0.1 test .org |
確認してみます。
1 2 3 4 | MacBook-Air:~ ito$ ping test .org PING test .org (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time =0.070 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time =0.193 ms |
ちゃんと設定されましたね!
この記事がお役に立てば【 いいね 】のご協力をお願いいたします!