Skip to content

Instantly share code, notes, and snippets.

@gdestree
Created December 18, 2017 19:48
Show Gist options
  • Select an option

  • Save gdestree/99675c733831ff05db746ee637f5b2bc to your computer and use it in GitHub Desktop.

Select an option

Save gdestree/99675c733831ff05db746ee637f5b2bc to your computer and use it in GitHub Desktop.

Revisions

  1. gdestree revised this gist Dec 18, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion dnsmasq-setup.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # Never touch your local /etc/hosts file in OS X again UPDATED for .test
    # Never touch your local /etc/hosts file in OS X again
    # UPDATED for .test

    > To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.
  2. gdestree created this gist Dec 18, 2017.
    50 changes: 50 additions & 0 deletions dnsmasq-setup.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    # Never touch your local /etc/hosts file in OS X again UPDATED for .test

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

    * [Homebrew](https://brew.sh/)
    * Mountain Lion -> High Sierra

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

    ## Setup

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

    ### Setup *.test
    ```
    echo 'address=/.test/127.0.0.1' >> $(brew --prefix)/etc/dnsmasq.conf
    ```
    ### Change port for High Sierra
    ```
    echo 'port=53' >> $(brew --prefix)/etc/dnsmasq.conf
    ```

    ## Autostart - now and after reboot
    ```
    sudo brew services start dnsmasq
    ```

    ## 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/test'
    ```

    ## 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 .test will go to the DNS server at 127.0.0.1