Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Proxmox - SPICE Client setup for MacOS

Proxmox - SPICE client setup for MacOS

  1. Install a working (and compiled) version of virt-viewer. You may view the homebrew package's upstream source on GitHub.

    brew tap jeffreywildman/homebrew-virt-manager
    brew install virt-viewer
  2. Once that's installed should be able make a call remote-viewer with a pve-spice.vv file downloaded from proxmox web interface

    remote-viewer pve-spice.vv

    Check out this useful script for debugging. There are also several other cli tools like this one on GitHub that can be used to test the same sort of thing.

Improving Quality of Life

We want remote-viewer to automatically start and open the session when we double click the VM entry in proxmox. To do that we need to first create a small helper application.

  1. Launch Automator and select Application from the dropdown list, when prompted.

    Screen Shot 2021-07-15 at 1 39 31 PM

  2. Search for shell and drag to the right. The contents:

    /usr/local/bin/remote-viewer "$@"

    Make sure to select as arguments for passing the input. Save as ~/Applications/pve-spice-launcher.app.

    Screen Shot 2021-07-15 at 2 13 01 PM

  3. Locate a pve-spice.vv file and right click, and go to Get Info -> Open With -> Change All, look for the .app file you just made.

    Screen Shot 2022-02-16 at 11 26 22 AM

  4. In Chrome, click on the small arrow on the list of downloads at the bottom, and select "Always open files of this type"

    Screen Shot 2021-07-15 at 2 02 46 PM

  5. If everything is set up correctly you should be able to double-click on the VM in the left pane of Proxmox and remote-viewer should start up and take care of the rest.

    Note: the pve-spice.vv files will be automatically deleted by remote-viewer

    Screen Shot 2021-07-15 at 2 05 57 PM

    Screen Shot 2021-07-15 at 4 42 21 PM

Enjoy!

#!/usr/bin/env bash
set -e
# needs pve-manager >= 3.1-44
usage() {
echo "Usage: $0 [-u <string>] [-p <string>] vmid [node [proxy]]"
echo
echo "-u username. Default root@pam"
echo "-p password. Default ''"
echo
echo "vmid: id for VM"
echo "node: Proxmox cluster node name"
echo "proxy: DNS or IP (use <node> as default)"
exit 1
}
PASSWORD=""
USERNAME=""
while getopts ":u:p:" o; do
case "${o}" in
u)
USERNAME="${OPTARG}"
;;
p)
PASSWORD="${OPTARG}"
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [[ -z "$PASSWORD" ]]; then
PASSWORD=""
fi
if [[ -z "$USERNAME" ]]; then
USERNAME='root@pam'
fi
DEFAULTHOST="$(hostname -f)"
# select VM
[[ -z "$1" ]] && usage
VMID="$1"
#[[ -z "$2" ]] && usage
NODE="${2:-$DEFAULTHOST}"
if [[ -z "$3" ]]; then
PROXY="$NODE"
else
PROXY="$3"
fi
NODE="${NODE%%\.*}"
DATA="$(curl -f -s -S -k --data-urlencode "username=$USERNAME" --data-urlencode "password=$PASSWORD" "https://$PROXY:8006/api2/json/access/ticket")"
echo "AUTH OK"
TICKET="${DATA//\"/}"
TICKET="${TICKET##*ticket:}"
TICKET="${TICKET%%,*}"
TICKET="${TICKET%%\}*}"
CSRF="${DATA//\"/}"
CSRF="${CSRF##*CSRFPreventionToken:}"
CSRF="${CSRF%%,*}"
CSRF="${CSRF%%\}*}"
curl -f -s -S -k -b "PVEAuthCookie=$TICKET" -H "CSRFPreventionToken: $CSRF" "https://$PROXY:8006/api2/spiceconfig/nodes/$NODE/qemu/$VMID/spiceproxy" -d "proxy=$PROXY" > $NODE-$VMID.vv
exec remote-viewer $NODE-$VMID.vv
@tomdaley92
Copy link
Author

@Mrdindon
Copy link

Mrdindon commented Feb 16, 2022

proxmox generates files without the vv extension in safari when I try to start a session. I understand that I should configure proxmox to use your pve-spice.sh but I don't see where / how to do so. Could you clarify that ?

@tomdaley92
Copy link
Author

tomdaley92 commented Feb 16, 2022

Hi @Mrdindon ,

I just tested with Chrome and Firefox and I am getting .vv files extensions with Chrome and files without extensions from Firefox. I use Firefox primarily, and it all works correctly, so I'm guessing this should work with Safari too.

Its been a long time, so I can't exactly remember how I got firefox functioning like this.. but it somehow knows to automatically open these files using the Automator script, just like Chrome for me, so perhaps Safari strips the .vv extension and just "knows" to open default program associated with .vv files defined in your OS.

Try manually associating a .vv file with the Automator script. I need to update the gist with better instructions but try right clicking - > get info -> Open With -> Change All -> select the .app you just created

The pve-spice.sh script is pretty ancient (from old proxmox forums, and not even sure if it still works, lol) and is used for testing/debugging SPICE connections via CLI instead of web browser. It is not used to configure Proxmox or anything like that. a spice proxy is built into proxmox, just need to enable it on the VM and install the necessary drivers inside the VM

@mikev1963
Copy link

If there is a way to have Safari download with the .vv extension would be great.

@maldins46
Copy link

Thanks! This guide helped me a lot. Anyway, I noticed that the SPICE client is somehow unstable on MacOS Big Sur (it crashes sometimes), and the clipboard does not always work between Mac and the Guest VM. Any suggestions to solve these problems?

@tomdaley92
Copy link
Author

tomdaley92 commented Mar 7, 2022

Thanks! This guide helped me a lot. Anyway, I noticed that the SPICE client is somehow unstable on MacOS Big Sur (it crashes sometimes), and the clipboard does not always work between Mac and the Guest VM. Any suggestions to solve these problems?

Cool, glad it helped! Yeah Virt-Viewer for MacOS is pretty experimental as far as I know and the performance is indeed terrible. If your looking for rock solid performance, using virt-viewer on a debian or another linux system is the way to go. Plus you get all the bells and whistles fully working like spice usb redirection and multiple spice displays etc..

@encryptblockr
Copy link

what is the association of PROXMOX with this? Is the MacOS created in PROXMOX?

@tomdaley92
Copy link
Author

what is the association of PROXMOX with this? Is the MacOS created in PROXMOX?

This is for configuring MacOS as a Spice client, nothing specific to Proxmox other than automatic browser assocation with the files downloaded from the proxmox WebUI

In this example MacOS would be a real physical machine (your machine) in order to establish a spice session with the spice proxy server (proxmox)

@encryptblockr
Copy link

getting errors

after installation with these

brew tap jeffreywildman/homebrew-virt-manager
brew install virt-viewer

then ran this

$ remote-viewer ~/Downloads/console.vv

and getting these errors

(remote-viewer:48501): GSpice-WARNING **: 15:56:15.241: Failed to create pipeline: no element "appsrc"

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GSpice-WARNING **: 15:56:15.241: Failed to create pipeline: no element "autoaudiosrc"

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

@tristan-k
Copy link

Will this work on Apple Silicon?

@tomdaley92
Copy link
Author

Will this work on Apple Silicon?

No idea. I have only tested this on my intel x86 2019 MBP. I am also not the author of virt-viewer for mac

@tomdaley92
Copy link
Author

getting errors

after installation with these

brew tap jeffreywildman/homebrew-virt-manager
brew install virt-viewer

then ran this

$ remote-viewer ~/Downloads/console.vv

and getting these errors

(remote-viewer:48501): GSpice-WARNING **: 15:56:15.241: Failed to create pipeline: no element "appsrc"

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GSpice-WARNING **: 15:56:15.241: Failed to create pipeline: no element "autoaudiosrc"

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(remote-viewer:48501): GLib-GObject-CRITICAL **: 15:56:15.241: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

Are you running on one of the new M1 chips?

@tomdaley92
Copy link
Author

I would go here for any specific issues with virt-viewer for mac:
https://github.com/jeffreywildman/homebrew-virt-manager

@MasinAD
Copy link

MasinAD commented Apr 27, 2022

Will this work on Apple Silicon?

It does. Just followed the instructions, worked like a charm. I just had to enter the correct path to remote-viewer:

masin@SI-C040:/Users/masin/Projekte % which remote-viewer
/opt/homebrew/bin/remote-viewer

Thanks, @tomdaley92

@phocean
Copy link

phocean commented Jun 2, 2022

Thanks, but it does not work with Firefox and Safari, as it does not get the file extension (*.vv) for some reason...

@tomdaley92
Copy link
Author

Thanks, but it does not work with Firefox and Safari, as it does not get the file extension (*.vv) for some reason...

I have it working just fine with Firefox. I'll try to reproduce and post here soon

@tomdaley92
Copy link
Author

tomdaley92 commented Jun 2, 2022

@phocean just because the extension is missing, does not mean that the MIME type is not detectable. Try opening the file with a text editor, you'll see a sort of header for virt-viewer :)

https://support.mozilla.org/en-US/kb/change-firefox-behavior-when-open-file#w_file-types-and-download-actions

I'm assuming the first step is similar to my guide, you'll probably want to check "always download similar files" on a virt-viewer file:

Screen Shot 2022-06-02 at 9 04 08 AM

And then adjust this In your firefox preferences:

Screen Shot 2022-06-02 at 9 00 29 AM

@mdcarrier
Copy link

Thanks, @tomdaley92
Worked perfectly!

@pinkworld123
Copy link

Issue sound from linux guest (linux mint, Ubuntu) do not work

I have setup Proxmox - SPICE client for MacOS via brew

brew tap jeffreywildman/homebrew-virt-manager
brew install virt-viewer

I have checked on SPICE client for Linux plays sound but on SPICE client for MacOS, sound do not work. Can you please tell me how to fix it? thanks

@phocean
Copy link

phocean commented Jun 8, 2022

@tomdaley92 Thanks, but I don't understand what's going on. It worked for a while and stopped for some reason.
I think the issue is with Mac OS. Now I have a warning when I try to associate the files with the script :

Capture d’écran 2022-06-08 à 21 39 17

It complains that it does not have enough information to complete the association. If I proceed with it, it would associate the script only for that current file, but not the other files without extension...

EDIT : nevermind, I messed up with the script : I managed to get it work, at least in Firefox, not Mac OS

@mrl22
Copy link

mrl22 commented Aug 1, 2022

Thank you but I am struggling with a brew package issue

configure: error: Package requirements (spice-client-gtk-3.0 >= 0.35
                                     spice-client-glib-2.0 >= 0.35) were not met:

Package 'gobject-introspection-1.0', required by 'spice-client-glib-2.0', not found

@muse-sisay
Copy link

muse-sisay commented Aug 4, 2022

@tomdaley92 Is it possible to open multiple instances of the automator app/script?

i.e Is it possible to have two or more spice windows open at one time with the automator script? Currently, if you try to open a second remote spice connection while you have another session running; you have to quit the running spice session for it to open.

@picov
Copy link

picov commented Aug 14, 2022

Thank you but I am struggling with a brew package issue

configure: error: Package requirements (spice-client-gtk-3.0 >= 0.35
                                     spice-client-glib-2.0 >= 0.35) were not met:

Package 'gobject-introspection-1.0', required by 'spice-client-glib-2.0', not found

Same error here with both Intel and M1 Mac.
Th required package is already installed.

$ brew install gobject-introspection
Warning: gobject-introspection 1.72.0_1 is already installed and up-to-date.
To reinstall 1.72.0_1, run:
brew reinstall gobject-introspection

@rumochnaya
Copy link

Thank you but I am struggling with a brew package issue

configure: error: Package requirements (spice-client-gtk-3.0 >= 0.35
                                     spice-client-glib-2.0 >= 0.35) were not met:

Package 'gobject-introspection-1.0', required by 'spice-client-glib-2.0', not found

The same issue with MacBook Pro 2018 and macOS Monterey 12.4

@picov
Copy link

picov commented Aug 19, 2022

@leachimus
Copy link

Hello everyone!

I think the whole thing no longer works correctly under macOS Ventura. i get the following error:

==> Installing virt-viewer from jeffreywildman/virt-manager
Error: Your Command Line Tools (CLT) does not support macOS 13.
It is either outdated or was modified.
Please update your Command Line Tools (CLT) or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 14.1.

Have installed the latest Xcode. Can someone help me?

@leachimus
Copy link

OK, we are getting a little closer to the point now, but now I have this problem.

https://gist.github.com/tomdaley92/789688fc68e77477d468f7b9e59af51c?permalink_comment_id=4272624#gistcomment-4272624

@dedene
Copy link

dedene commented Nov 2, 2022

OK, we are getting a little closer to the point now, but now I have this problem.

https://gist.github.com/tomdaley92/789688fc68e77477d468f7b9e59af51c?permalink_comment_id=4272624#gistcomment-4272624

You can use https://github.com/Damenly/homebrew-virt-manager instead for virt-manager. Works fine under macOS Ventura using the latest Xcode 14.1

@bytemain
Copy link

bytemain commented Nov 9, 2022

use:

brew install damenly/virt-manager/virt-viewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment