Parallels VM: Is there a way to run a script on the host when launching a VM?
Absent somebody pointing out a way to do this within Parallels itself, here's a solution using only native utilities - thanks @user3439894 for suggesting a Launch Agent!

Create a /usr/local/bin/parallels_vm_starting shell script and chmod 755 it to make it executable:

#!/bin/bash

(
    echo &quot;----------&quot;
    date

    if /usr/bin/tty -s
    then
        echo &quot;interactive&quot;
    else
        # sleep for a bit to give things a chance to settle
        echo &quot;background - let things settle&quot;
        sleep 15
        date
    fi

    # Actions to perform when hosted VM starts up

    /usr/local/Homebrew/bin/brew services restart redis

    # etc. as needed

    date

) 2&gt;&amp;1 | tee -a /tmp/vm-startup.log


Create a Launch Agent file ~/Library/LaunchAgents/parallels_vm_startup.plist with this content:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
        &lt;string&gt;parallels_vm_startup&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
            &lt;string&gt;/usr/local/bin/parallels_vm_starting&lt;/string&gt;
        &lt;/array&gt;
    &lt;key&gt;WatchPaths&lt;/key&gt;
        &lt;array&gt;
            &lt;string&gt;/Library/Preferences/Parallels/parallels_dhcp_leases&lt;/string&gt;
        &lt;/array&gt;
    &lt;key&gt;StandardOutPath&lt;/key&gt;
        &lt;string&gt;/dev/null&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;

This will monitor the file /Library/Preferences/Parallels/parallels_dhcp_leases, which Parallels modifies when the VM starts (assuming the VM has networking enabled), and will execute the shell script when that happens.
Note: the DHCP leases file is regularly updated while the VM is up. If you only want to react to a VM being launched or shut down, monitor the file /Library/Preferences/Parallels/vmdirectorylist.desktop.xml instead.

Activate the Agent: launchctl load ~/Library/LaunchAgents/parallels_vm_startup.plist