VMware Communities
dsmcd01
Contributor
Contributor

Terminal commands to gracefully stop/suspend VM and start it again

Hi...

I'm looking for terminal commands to suspend a VM (or gracefully quit VMWare), then open the VM. I'm a novice with VMWare Fusion and OS X so hopefully I'm not missing anything too obvious.

VMWare 1.1 on Leopard. VM is Ubuntu 7.04.

TIA,

D.

6 Replies
rcardona2k
Immortal
Immortal

To open a virtual machine from Terminal, that's easy enough:

$ open "~/Documents/Virtual Machines/ VMName .vmwarevm", e.g.

open "~/Documents/Virtual Machines/Ubuntu.vmwarevm"

Shutting down VMware Fusion is a bit more complicated... You can ask VMware Fusion to quit via Applescript UI but you may get prompts that block the shutdown, e.g. the command is:

osascript -e 'tell app "VMware Fusion" to quit'

To prevent blockages, beforehand, you can ask your VM(s) to shut themselves down gracefully. In Ubuntu the command line is "shutdown -h now". You would have to execute this remotely like over ssh. If your guest VMs are off before you ask Fusion to quit, there should be no problems.

If you want your VMs to suspend, you'll have to do more Applescript UI scripting to drive the suspend operation via the menus. It's a bit cumbersome but it can work.

edit: changed Windows example to Ubuntu

dsmcd01
Contributor
Contributor

OK, thanks. SSH is something I've always procrastinated learning about, but I guess there's no time like the present, eh? :smileyblush:

Thanks again.

0 Kudos
srobadelic
Contributor
Contributor

Good article on using vmrun from command line (which can be wrapper into an ocascript for Applescript)

here: http://jamesreubenknowles.com/vmrun-fusion-2132

You must set the path to it before you can use it. Once you have the path set, you can use vmrun

It also refers to a VMWare doc on using vmrun here: http://www.vmware.com/pdf/vix180_vmrun_command.pdf

0 Kudos
WoodyZ
Immortal
Immortal

@srobadelic You're considerably late to the party as this thread is over 7 years old and should have been left to RIP!

0 Kudos
hevisko
Contributor
Contributor

@WoodyZ the answer given by @srobadelic is the exact answer I am/was looking for... the only pain is that finding that URL for the LATEST version(s) of vmrun is a pita ;(

0 Kudos
etrock99
Contributor
Contributor

osascript -e 'tell app "VMware Fusion" to quit'

==>work fine in macOS 10.14.3 Smiley Happy

0 Kudos