Open VNC virt-viewer (.vv) files on macOS

I tried to use virt-viewer from homebrew but it didn’t work properly. Instead I decided to write an Automator App that reads the contents of the .vv file and opens the macOS built-in VNC viewer.

Create a new Automator Application, and add the “Run Shell Script” action and choose to pass input as arguments. Select python as the shell and enter the following code:

import configparser
import sys
import os
config = configparser.ConfigParser()[1])
os.system("open vnc://:"+config['virt-viewer']['password']+"@"+config['virt-viewer']['host']+":"+config['virt-viewer']['port'])

Save the action under /Applications. In Finder, open the .vv file with this new app and choose to always open this file extension with it. Now when you double click on a .vv file in Finder, it should open the VNC console.