0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【hosts】macでhostsファイルを書き換える

Last updated at Posted at 2023-08-29

やりたいこと

macでhostsファイルを書き換えたい

hostsファイルとは?
IPアドレスとホスト名の組み合わせが一覧で記載されているテキストファイルです。
hostsファイルに記述された内容はDNSよりも優先されるので、hostsファイルを書き換えることで、DNSに関係なく公開前のウェブサイトの動作確認が可能になります。

※hostsファイルはPCごとに存在しているので、記述内容が反映されるのはそのPCだけです。

やり方

今回はターミナルを使います。

1.ターミナルを開いたら以下を入力(入力後パスワード入力してください)

sudo vi /private/etc/hosts

2.iを押してエディタをインサートモード(テキストを編集できる状態)にします。

3.編集

4.インサートモードを終了するため、escキーを押します。

5.:wqと入力し、Enterキーを押してvimの内容を保存します。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?