Tag Archives: vmware

Control VMware Fusion from the Command Line


Virtualization has been a key technology for me as a contractor. Because I have multiple clients, keeping their projects sequestered from each other is a snap: one or more VMs (virtual machines) per project. Development, testing, and in some cases deployment is all on separate VMs.

I’ve been using VMware Workstation since it first came out 1999. The ability for me to seamlessly move VMs between Windows, Linux, and OS X has been a key reason I’ve stuck with them for so long.

Automating tasks via scripting one of many reasons I insist that my workstation run  Un*x of some flavour. I’ve been using OS X for quite a while quite happily as a software developer, however VMware Fusion (for OS X) doesn’t present the full set of features available on VMware Workstation (for Linux and Windows). Fortunately hidden under the hood are the same tools.

The Executable vmrun

VMware provides a tool called vmrun that allows common operations to be performed on VMs — starting, suspending, taking snapshots, etc. On OS X it’s tucked away in the VMware Fusion bundle under Contents/Library.

In my shell startup I add the directory to PATH:

# VMware Fusion
if [ -d "/Applications/VMware Fusion.app/Contents/Library" ]; then
export PATH=$PATH:"/Applications/VMware Fusion.app/Contents/Library"

Find the Virtual Machine’s .vmx File

To use vmrun you need to have the path to the .vmx file that resides inside of the VM bundle on OS X. For example, I have a VM with an install of RedHat Enterprise Linux 7:


This is actually not a single file, but a directory called RHEL7.vmwarevm. The contents can be seen in the Finder by right clicking:

Show Contents

This will open up the directory and show the various files that make up the virtual machine.

Inside the Bundle

As can be seen, the .vmx file is prominently displayed.

Put the Pieces Together

To start the VM from the command line one uses the “start” parameter. For example, if the above virtual machine were in one’s home directory one can type:

$ vmrun start ~/RHEL7.vmwarevm/RHEL7.vmx

vmrun Commands

If one runs vmrun without parameters it gives a farily long summary of commands that it accepts. One can:

  1. control the power state of the VM,
  2. control snapshots,
  3. perform various operations inside a running VM, and
  4. other operations such as installing tools and cloning.

A short list of common operations:

Description Command Parameters
List running VMs list
Start a VM start /path/to/vmx/file
Suspend a VM suspend /path/to/vmx/file
Take a snapshot snapshot /path/to/vmx/file snapshot name

 Additional Information

VMware has a PDF on vmrun here.


GParted: Mouse Alignment Wrong in VMWare Fusion

GParted is a nice Open Source partition editor. Because altering partitions is often a task that must be done by booting from a CD, it’s available as a “live” CD image.

In VMware Fusion, if you try to use GParted to resize a Windows partition, you may have encounter a problem with the mouse pointer not appearing in the right place. If you put the mouse cursor over something and click, the click happens further above and to the left. It’s a maddening process to try to figure out how far down and to the right you have to position the cursor to click in the right place.

My workaround is to change the virtual machines’ operating system setting in Fusion before booting to the GParted disk. Do this by shutting down the virtual machine, then click on the setting button to bring up the configuration screen. The drop down menu should be changed to Linux ➔ Debian to reflect the live CD’s operating system.

Now the mouse should work as expected in GParted.


When you have finished with GParted, power off the virtual machine and return the virtual machine’s operating system setting to its original value. The virtual machine will certainly run if you don’t, but you may suffer a performance hit. VMware uses the operating system setting to tweak its internals and boost the performance of the virtual machine.

Fixing Windows 7 Network on VMware

After installing Windows 7 in a VMware virtual machine, it could not activate the networking card. The Device Manager claimed that it could not recognize the NIC, despite VMware Tools being installed.

To fix the problem, I shut down the virtual machine and added the following to the .vmx file:

ethernet0.virtualDev = "e1000"

When the virtual machine was restarted, Windows 7 detected and activated the network card without a problem.

Required Packages to Run VMware Workstation on Fedora 11

Having a new workstation to prepare for use, Fedora 11was tested and chosen over CentOS 5.3 because of the cutting-edge hardware. VMware  Workstation 6.5 tends to install cleanly on CentOS, but not on the newer Fedora kernels. I needed to install the following packages to get Workstation to run:

  1. gcc
  2. libstdc++
  3. kernel
  4. kernel-devel
  5. kernel-headers

These can be installed with a single yum command:

$ sudo yum install gcc libstdc++ kernel kernel-devel kernel-headers

At this point Workstation should find everything that it need to build its kernel modules.

Resizing a Windows System Partition in a VMware Virtual Machine

Resizing the system (boot) partition of a Windows machine is non-trivial; the disk cannot be in use at the time. When Windows resides in a virtual machine, you can expand the virtual disk, but that does not change the size of the Windows partition.

Pat Lee of VMware has a nice summary of the process here.