6
Is there a file that I can view/edit from terminal that has a list of the search domains?
I know it's possible to set these up from the DNS tab in the Network preferences, but is there a way to do it over the terminal?
6
Is there a file that I can view/edit from terminal that has a list of the search domains?
I know it's possible to set these up from the DNS tab in the Network preferences, but is there a way to do it over the terminal?
9
You wouldn't necessarily need to view/edit a specific file. In OSX, Mac allows you to modify or set DNS configs among other things by running the networksetup command. The full path is: /usr/sbin/networksetup
Since it's in /usr/sbin -you should be able run the networksetup command from anywhere within the terminal.
You can run something like this:
networksetup -setsearchdomains Ethernet labs.example.com staging.example.com
Hope this helps.
Custom TLDs were (sometimes) failing for me on Mac. So, I used a search domain to 'default' to a *.dev url (for local development).
If you need to reset/clear out your custom search domains that you set via the above command use this:
networksetup -setsearchdomains Ethernet Empty
Also, to programmatically get your active network interface, look at this bash script: http://apple.stackexchange.com/a/223446/111516