Sometimes Cato VPN's latency can deterioriate overtime and a simple workaround is to restart the app and reconnect to the VPN.
-
Download the apple script
wget https://gist.githubusercontent.com/nitrocode/559f1717ee5d610c3548b3e056b84e5e/raw/catovpn_restart.scpt \ -O /usr/local/bin/catovpn_restart.scpt chmod +x /usr/local/bin/catovpn_restart.scpt
- This can now be run manually using
osascript /usr/local/bin/catovpn_restart.scpt
- This can now be run manually using
-
Download the plist
This defaults to running every hour (3600 seconds) which is controlled by the
StartInterval
and can be modified once this file is downloaded.wget https://gist.githubusercontent.com/nitrocode/559f1717ee5d610c3548b3e056b84e5e/raw/local.nitrocode.catovpn_restart.plist \ -O ~/Library/LaunchAgents/local.nitrocode.catovpn_restart.plist
-
Load the plist
launchctl load ~/Library/LaunchAgents/local.nitrocode.catovpn_restart.plist
It is required to add
osascript
to Security & Privacy > Accessibility and if testing locally, the following may want to be added too:- AppleScript
- Script Editor
- Terminal
- iTerm
Note: This will not insert your 2fa but it will prompt you when the previous 2fa session token has expired.
If the interval is to be modified, the plist will have to be unloaded and reloaded.
launchctl unload ~/Library/LaunchAgents/local.nitrocode.catovpn_restart.plist
launchctl load ~/Library/LaunchAgents/local.nitrocode.catovpn_restart.plist
launchctl unload ~/Library/LaunchAgents/local.nitrocode.catovpn_restart.plist
rm ~/Library/LaunchAgents/local.nitrocode.catovpn_restart.plist
rm /usr/local/bin/catovpn_restart.scpt