markdown 在OS X上设置dnsmasq

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 在OS X上设置dnsmasq相关的知识,希望对你有一定的参考价值。

# Never touch your local /etc/hosts file in OS X again

> To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

## Requirements

* [Homebrew](http://mxcl.github.io/homebrew/)
* Mountain Lion

## Install
```
brew install dnsmasq
```

## Setup

### Create config directory
```
mkdir -pv $(brew --prefix)/etc/
```

### Setup *.dev

```
echo 'address=/.dev/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf
```

You should probably add `strict-order` to `dnsmasq.conf` to keep nameserver order of `resolv.conf` ([see here](https://gist.github.com/drye/5387341)).

## Autostart

### Work after reboot
```
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
```

### Get it going right now
```
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
```

## Add to resolvers

### Create resolver directory
```
sudo mkdir -v /etc/resolver
```

### Add your nameserver to resolvers
```
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev'
```

## Add local DNS to search order in System Preferences

System Preferences > Network > Wi-Fi (or whatever you use) > Advanced... > DNS > add 127.0.0.1 to top of the list.

## Finished

That's it! You can run scutil --dns to show all of your current resolvers, and you should see that all requests for a domain ending in .dev will go to the DNS server at 127.0.0.1

以上是关于markdown 在OS X上设置dnsmasq的主要内容,如果未能解决你的问题,请参考以下文章

ini 在Mac OS X上设置dnsmasq

sh 翻译:“OS X 10.10 Yosemite本地开发环境,Apache,PHP和MySQL与Homebrew”14。安装,配置DNSMasq

markdown Mac OS X设置。

sh 翻译:“OS X 10.10 Yosemite本地开发环境,Apache,PHP和MySQL与Homebrew”15。 DNSMasq成功安装后的返回结果

markdown Mac OS X Rails开发环境设置

markdown 在Mac OS X上安装Go