存档在 2015 年 3 月

Warning: Use of undefined constant archives - assumed 'archives' (this will throw an Error in a future version of PHP) in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: Use of undefined constant page - assumed 'page' (this will throw an Error in a future version of PHP) in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: A non-numeric value encountered in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: A non-numeric value encountered in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32
class="post-1504 post type-post status-publish format-standard hentry category-gems-of-others tag-mac">

如何在 Mac OS X 下设置 host ?

2015年3月3日

一般青年:

先sudo -i临时获取管理员权限,会提示你输入密码,就是启动的密码。
然后 vi /etc/hosts
前面的vi是编辑器,当然也可以换用其他的,例如上面的nano。
/etc/hosts 是hosts内容,编辑完保存就OK。

屌丝青年(推荐):

刚才网上找到一个比较适合小白的办法:
(1)点击 Finder,在顶部菜单栏选择“前往”-“前往文件夹”,粘入 “/private/etc/” 这个路径(不带引号)
(2)找到 “hosts” 文件,复制一份到桌面。用 Mac OS X 系统自带的文本编辑器就能编辑 hosts 文件。添加好你要访问(或者拦截)的网站相关 hosts 信息后保存,拖回 Finder 里的 /private/etc/ 文件夹下即可。拖回去的时候,Mac 会弹出报警说无法移动项目。点击“认证”按钮然后输入电脑密码即可。