How to force MacOS to regenerate /etc/resolv.conf file? Apple states clearly that the /etc/resolv.conf file is managed by Mac OS so it will be regenerated. The problem is that it seems that when I join the OpenVPN this does not happen and as a result tools like nslookup fail to see the vpn.

#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
#
# This file is automatically generated.
#
domain local
nameserver 192.168.1.1


I need to know which command can I run in order to force MacOS (Sierra) to regenerate the file.

As you can see my file does not contain the correct list of DNS servers. For example the scutil --dns returns a long list of DNS servers, one that includes the OpenVPN dns servers.
I found a solution today. Actually the file is not /etc/resolv.conf in mac OS. It is /var/run/resolv.conf

So do this:

sudo rm /etc/resolv.conf
sudo ln -s /var/run/resolv.conf /etc/resolv.conf