Brew openvpn-connect on macos fails to upgrade or remove

homebrewupgrade

I installed openvpn-connect with brew install –cask openvpn-connect
all good
Today I run brew update; brew upgrade, there was an upgrade for openvpn-connect, the upgrade failed.
I have since tried to uninstall it completely but the uninstall fails with:

    ==> Removing launchctl service org.openvpn.helper
    ==> Running uninstall script /Applications/OpenVPN Connect/Uninstall OpenVPN Connect.app/Contents/Resources/remove.sh
    Warning: uninstall script /Applications/OpenVPN Connect/Uninstall OpenVPN Connect.app/Contents/Resources/remove.sh does not exist; skipping.
    ==> Uninstalling packages:
    org.openvpn.client.pkg
    find: /Applications/OpenVPN Connect/OpenVPN Connect.app: No such file or directory
    Error: Failure while executing; `/usr/bin/sudo -E -- /usr/bin/xargs -0 -- /bin/bash -c set\ -euo\ pipefail'
    ''
    'for\ path\ in\ \"\$\{@\}\"\;\ do'
    '\ \ if\ \[\[\ -e\ \"\$\{path\}/.DS_Store\"\ \]\]\;\ then'
    '\ \ \ \ /bin/rm\ -f\ \"\$\{path\}/.DS_Store\"'
    '\ \ fi'
    ''
    '\ \ \#\ Some\ packages\ leave\ broken\ symlinks\ around\;\ we\ clean\ them\ out\ before'
    '\ \ \#\ attempting\ to\ \`rmdir\`\ to\ prevent\ extra\ cruft\ from\ accumulating.'
    '\ \ /usr/bin/find\ \"\$\{path\}\"\ -mindepth\ 1\ -maxdepth\ 1\ -type\ l\ \!\ -exec\ /bin/test\ -e\ \{\}\ \\\;\ -delete'
    ''
    '\ \ if\ \[\[\ -L\ \"\$\{path\}\"\ \]\]\;\ then'
    '\ \ \ \ \#\ Delete\ directory\ symlink.'
    '\ \ \ \ /bin/rm\ \"\$\{path\}\"'
    '\ \ elif\ \[\[\ -d\ \"\$\{path\}\"\ \]\]\;\ then'
    '\ \ \ \ \#\ Delete\ directory\ if\ empty.'
    '\ \ \ \ /usr/bin/find\ \"\$\{path\}\"\ -maxdepth\ 0\ -type\ d\ -empty\ -exec\ /bin/rmdir\ \{\}\ \\\;'
    '\ \ else'
    '\ \ \ \ \#\ Try\ \`rmdir\`\ anyways\ to\ show\ a\ proper\ error.'
    '\ \ \ \ /bin/rmdir\ \"\$\{path\}\"'
    '\ \ fi'
    'done'
    ' --` exited with 1. Here's the output:
    find: /Applications/OpenVPN Connect/OpenVPN Connect.app: No such file or directory

The application appears to be gone, however brew still tracks is as installed.

Best Answer

I also have this issue yesterday and try a lot times today. Here it goes:

rm -r /usr/local/Caskroom/openvpn-connect
brew update-reset && brew update
brew install --cask openvpn-connect

if successfully installed, you can try uninstall to ensure that.

brew uninstall openvpn-connect

Hope it works for you.