Starting VMware Fusion VMs from the CLI (‘vmrun’)

This is a smaller image of the VMware Fusion closing VM dialogue.

Over the past several weeks I’ve been prepping for the Docker Certified Associate (DCA) test.  And in so doing, I have created a relatively robust environment I’ve been running it with seven virtual machines all running a CentOS minimal installation– all this on a 16GB 2015 MacBook Pro.

How would you like to start and close seven machines and see this for every virtual machine?

This is an image of the VMware Fusion 'closing window' dialogue.
VMware Fusion Closing Window Dialogue


I didn’t think so. And that’s mentioning the opening and starting them (click, click, click, click…ad nauseam). I just want to get my machines up and running. Fast.

Well, you’re probably thinking– use the CLI! Yep, that’s the thing to do. And you’d probably start by searching the web for something like “VMware fusion CLI command to start VM” or some such thing. When you do, you’ll likely find the following URL: This reference appears to be good for VMware Fusion 8.5 Pro as well (which is what I run).

It works well. Just write a quick bash script and you’re on your way! But be aware! VMware Fusion installs itself (at least version 8.5) with a space character in the name. If you write a script different from mine– say using the find utility in the script instead of a file, you may experience odd happenings (hence my use of the externally read file).

For me, this meant I did a quick find for all the .vmx files within my ~\Documents\VMwareFusion\Docker folder, awked the filenames into a file, and then wrote a quick script to read that file and start the machines.

For me, I added a 5-second interval between each start command to keep my MBPro fans from kicking in so strong.

Here’s my script:
#! /bin/bash
# This is a quick shell script to start multiple VMs without opening the VMware Fusion GUI/Library, nor seeing the VM's GUI.

# I may modify by changing the static filename to the $1 input (i.e., adding filename="$1" at line 6 and modifying line 11 as--> done < "$filename"

while read -r line;
echo -e "\nStarting VM:\n Issuing vmrun start nogui command for:\n $line";
$(/Applications/VMware\ start "$line" nogui);
echo -e "\nPausing for 5 seconds..."
sleep 5;
# NOTE: The macOS version of 'sleep' only recognizes the value as seconds.
done < "./large-docker.txt"

echo -e "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo -e "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo -e "Finished starting VMs. Script Complete."
echo -e "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo -e "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="

The large-docker.txt file looks like the following:


And if you want to check and see what VMs are running, you’ll want to run
/Applications/VMware\ -t ws list. This will tell you the total number of running VMs within VMware and which ones by the .vmx file.

That’s it!

Leave a Reply

Your email address will not be published. Required fields are marked *