9

I added a VPN config. Now I want to remove it, but the - button is gray and disabled.

I checked some answers from this Apple Support Communities thread:

In Terminal: networksetup -listallnetworkservices
In Terminal: networksetup -removenetworkservice networkservice
In Terminal: networksetup -listallnetworkservices

…but I cannot remove all.

How can I fix this issue?

6 Answers 6

2

You can manually delete the service by removing it from the relevant preferences file.

Make sure System Preferences and any other software that may attempt to switch network locations is quit before beginning.

  1. Make a backup of the preferences file.

    cd /Library/Preferences/SystemConfiguration
    sudo cp preferences.plist preferences.plist.old
    
  2. Give yourself permission to the preference file.

    sudo chown $USER preferences.plist
    sudo chmod u+w preferences.plist
    
  3. Open the preference file. I will use Xcode to open the file.

    open preferences.plist
    
  4. Use ⌘F to open Find, and search for the name of your VPN service.

  5. The name of your VPN should be shown in a UserDefinedName key.

  6. Select the ID of the network service above the search result.

    In this case, I would select the one beginning CD2362

  7. Use ⌫ backspace to delete the entire dictionary. Make sure that the only data that is deleted is this dictionary and its contents, not any of the other dictionaries.

  8. Save the file and reboot.

0
9

Some VPN interfaces must be removed from the VPN Profiles system preference, instead of the Network Interface system preference:

System Preference > Profiles > Select VPN profile > Remove.

System Preferences with Profiles highlighted Profiles preferences pane

2
  • 1
    I'm not sure why someone downvoted this. This actually fixed the problem I have. When the remove button is grayed out, it mean that such VPN service is added by a profile file. And to remove the VPN service, you will need to delete the profile file that's responsible for it.
    – toaruScar
    Commented Dec 18, 2017 at 17:11
  • This preference pane was removed in macOS Big Sur. You can maybe still access it with open /System/Library/PreferencePanes/Profiles.prefPane. Commented Dec 8, 2021 at 18:12
2

networksetup -removenetworkservice networkservice SHOULD be "networkservice" The networkservice was the name of the VPN.

For the last one, If you cannot remove the network configuration because you get an error saying it is the only network service on ipv4, click the plus button to add another network configuration, and add one that would be on ipv4 such as 6 to 4, you can then use the terminal command to delete the configuration you were attempting to delete before, and remove the 6 to 4 using the minus button.

See: https://www.jamf.com/jamf-nation/discussions/19838/can-t-remove-vpn-network-service-created-by-configuration-profile

2
  • This worked! However, I still have a couple services listed in the Network tab that were installed by HotSpot Shield, but that are no longer listed in networksetup -listallnetworkservices. I don't see them in /Library/Preferences/SystemConfiguration/preferences.plist either. Commented Dec 8, 2021 at 18:08
  • Aha, they exist in /Library/Preferences/com.apple.networkextension.plist, which I think can only be edited by disabling SIP. help.nextdns.io/t/g9hf600/… Commented Dec 8, 2021 at 19:32
1

In macOS X Sierra after coming across https://discussions.apple.com/thread/3828655?tstart=0 I was able to delete a VPN item that had a greyed out "-" button, even thought I had deleted the "Profile" it was associated with. I did so by the following commands:

1: In terminal, networksetup -listallnetworkservices gives a list of the names of the services.

2: In terminal, networksetup -removenetworkservice "name of service in quotes" will remove the desired service - the quotes are needed to take care of spaces and other fancy characters - they could be escaped with backslashes (\) instead. This might be the bit that messed up the original author.

3: In terminal networksetup -listallnetworkservices gives a list of the names of the services, hopefully showing that the undesired one is now gone.

1

Remove the VPN using command:

networksetup -deletepppoeservice "name of your VPN"
-1

Prior to Monterey the command was networksetup, which in Monterey became networkservices.

You need sudo to delete profiles of another user.

Also bear in mind that profiles installed unter another user are not visible in System Preferences.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .