macOS 的 hosts 檔案位於 /etc/hosts,屬於系統保護檔案,無法直接在 Finder 中編輯。
/etc 前往資料夾。hosts 檔案,將其 拖曳到桌面 建立副本。

sudo vim /etc/hosts
# 或
sudo nano /etc/hosts
輸入密碼後直接編輯儲存,無需拖曳替換。
127.0.0.1 dev.local0.0.0.0 analytics.example.com192.168.1.10 gitlab修改後無需重啟,瀏覽器可能需清除 DNS 快取(
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder)才能立即生效。