Tool for pointing wildcarded domains to your local development machine
Dnsmasq provides network infrastructure for small networks. dnsmasq-mgmt
is a tool that installs Dnsmasq and eases the configuration to locally point domains to IP addresses of your choosing.
dnsmasq-mgmt was built to avoid manually updating Dnsmasq or /etc/hosts configuration files.
Currently dnsmasq-mgmt is only supported on macOS.
Use composer to install dnsmasq-mgmt via:
composer global require "lightster/dnsmasq-mgmt=~0.0.9"
Then allow dnsmasq-mgmt to restart Dnsmasq and clear the operating system's DNS cache without requesting the sudo password each time:
sudo ~/.composer/vendor/bin/dnsmasq-mgmt sudoers:install
The last step in installation is to actually install Dnsmasq and setup directories utilized by Dnsmasq:
~/.composer/vendor/bin/dnsmasq-mgmt dnsmasq:install
To have b.com
point and subdomains of b.com
point to localhost, run:
~/.composer/vendor/bin/dnsmasq-mgmt address:add b.com 127.0.0.1
To remove b.com
, run:
~/.composer/vendor/bin/dnsmasq-mgmt address:add b.com 127.0.0.1
Rather than needing to call dnsmasq-mgmt
with a path of ~/.composer/vendor/bin/dnsmasq-mgmt
every time, add ~/.composer/vendor/bin/
to the PATH environment variable in your ~/.bash_profile
configuration:
PATH="$PATH:${HOME}/.composer/vendor/bin"
dnsmasq-mgmt offers a few other commands. You can get a full list of commands by running the list
subcommand:
dnsmasq-mgmt list
If you are using bash or zsh, you can install shell completion for dnsmasq-mgmt.
For Bash, add the following to your ~/.bashrc
(or ~/.bash_profile
):
source ~/.composer/vendor/lightster/dnsmasq-mgmt/bin/dnsmasq-mgmt-completion.bash
For zsh, add the following to your ~/.zshrc
:
source ~/.composer/vendor/lightster/dnsmasq-mgmt/bin/dnsmasq-mgmt-completion.zsh