Under Yosemite (and El Capitan), the launch launchctl utility changed.
For dnsmasq:
brew install dnsmasqorbrew upgrade dnsmasqsudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons- In
/usr/local/etc/dnsmasq.confadd the lineaddress=/devel/127.0.0.1(do NOT adddevas this is now a top-level TLD) sudo launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plistsudo launchctl enable system/homebrew.mxcl.dnsmasqsudo launchctl kickstart -kp system/homebrew.mxcl.dnsmasqlaunchctl print | grep dnsmasq, you should see an entry for DNSMasq with a pid number (not a-, which means it isn't running)- In System Preferences -> Network -> Advanced -> DNS, add an entry for
127.0.01and move it to the top of the list dig fancydomain.devel, you should get an immediate response from the local host
NOTE: You can also create /etc/resolver/devel with contents nameserver 127.0.0.1 to avoid using System Preferences.
NOTE: If you use VPN, this setup will likely change every time you connect/disconnect. You'll have to add the search domain manually to your connections.
For nginx:
- Install and configure Nginx
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchAgentssudo launchctl bootstrap system /Library/LaunchAgents/homebrew.mxcl.nginx.plistsudo launchctl enable system/homebrew.mxcl.nginxsudo launchctl kickstart -kp system/homebrew.mxcl.nginxlaunchctl print | grep nginx, you should see an entry for Nginx with a pid number (not a-, which means it isn't running)
Note that for both services, you need to bootstrap and enable the service before starting them via kickstart. If you receive errors that launchctl cannot find a service in the specified domain, it's probably because it was not bootstrapped. If you see a pid number of zero, then Nginx did not successfully start and likely has a configuration error.
UPDATE 2019:
Do not use load or unload anymore, as they are deprecated. Additionally, some of the semantics of starting services were updated to the following (for a per-user daemon):
- Get your user identifier with
id -u. launchctl bootstrap user/<your-uid> file.name.of.service.plistlaunchctl kickstart -k system/<your-uid>/label.name.of.service- To stop service:
launchctl bootout user/<your-uid> file.name.of.service.plist