Created
November 25, 2012 08:43
-
-
Save raoulwegat/4142864 to your computer and use it in GitHub Desktop.
OS X service to add folder name to localhost DNS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is my workaround to an otherwise automated Apache/vhost + dnsmasq +/etc/resolver/dev setup that fails when I'm offline and my local sites are unreachable. After I create a folder under ~/Sites, I now right-click > Services > Add Site to DNS and my sites are available offline. It's sudo vi /etc/hosts workaround. | |
To cleanup/maintain, use the dscl commands from here: | |
http://tomafro.net/2009/07/dscl-the-easy-way-to-add-hosts-on-osx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" | |
set theItems to selection | |
set folderName to name of item 1 of theItems | |
do shell script "sudo dscl localhost -create /Local/Default/Hosts/" & folderName & ".dev IPAddress 127.0.0.1" | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment