---
modeline: |
  vim: set ft=pandoc:
description: |
  This VMware Packer builder is able to create VMware virtual machines from an
  existing VMware virtual machine (a VMX file). It currently supports building
  virtual machines on hosts running VMware Fusion Professional for OS X, VMware
  Workstation for Linux and Windows, and VMware Player on Linux.
page_title: VMware VMX - Builders
sidebar_title: VMWare VMX
---

# VMware Builder (from VMX)

Type: `vmware-vmx`
Artifact BuilderId: `mitchellh.vmware`
If remote_type is esx: Artifact BuilderId: `mitchellh.vmware-esx`

This VMware Packer builder is able to create VMware virtual machines from an
existing VMware virtual machine (a VMX file). It currently supports building
virtual machines on hosts running [VMware Fusion
Professional](https://www.vmware.com/products/fusion-professional/) for OS X,
[VMware Workstation](https://www.vmware.com/products/workstation/overview.html)
for Linux and Windows, and [VMware
Player](https://www.vmware.com/products/player/) on Linux.

The builder builds a virtual machine by cloning the VMX file using the clone
capabilities introduced in VMware Fusion Professional 6, Workstation 10, and
Player 6. After cloning the VM, it provisions software within the new machine,
shuts it down, and compacts the disks. The resulting folder contains a new
VMware virtual machine.

## Basic Example

Here is an example. This example is fully functional as long as the source path
points to a real VMX file with the proper settings:

<Tabs>
<Tab heading="JSON">

```json
{
  "type": "vmware-vmx",
  "source_path": "/path/to/a/vm.vmx",
  "ssh_username": "root",
  "ssh_password": "root",
  "shutdown_command": "shutdown -P now"
}
```

</Tab>
<Tab heading="HCL2">

```hcl
source "vmware-vmx" "basic-example" {
  source_path = "/path/to/a/vm.vmx"
  ssh_username = "root"
  ssh_password = "root"
  shutdown_command = "shutdown -P now"
}

build {
  sources = ["sources.vmware-vmx.basic-example"]
}
```

</Tab>
</Tabs>

## Configuration Reference

There are many configuration options available for the VMware builder. They are
organized below into two categories: required and optional. Within each
category, the available options are alphabetized and described.

There are many configuration options available for the builder. In addition to
the items listed here, you will want to look at the general configuration
references for
[HTTP](#http-directory-configuration),
[Floppy](#floppy-configuration),
[Boot](#boot-configuration),
[Driver](#driver-configuration),
[Output](#output-configuration),
[Run](#run-configuration),
[Shutdown](#shutdown-configuration),
[Communicator](#communicator-configuration),
[Tools](#tools-configuration),
[vmx](#vmx-configuration),
[Export](#export-configuration),
configuration references, which are
necessary for this build to succeed and can be found further down the page.

### Required:

@include 'builder/vmware/vmx/Config-required.mdx'

#### Optional:

@include 'builder/vmware/vmx/Config-not-required.mdx'

### Extra Disk Configuration

#### Optional:

@include 'builder/vmware/common/DiskConfig-not-required.mdx'

### Http directory configuration

@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx'

#### Optional:

@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig-not-required.mdx'

### Floppy configuration

@include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig.mdx'

#### Optional:

@include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig-not-required.mdx'

### CD configuration

@include 'packer-plugin-sdk/multistep/commonsteps/CDConfig.mdx'

#### Optional:

@include 'packer-plugin-sdk/multistep/commonsteps/CDConfig-not-required.mdx'

### Export configuration

#### Optional:

@include 'builder/vmware/common/ExportConfig-not-required.mdx'

### Output configuration

#### Optional:

@include 'builder/vmware/common/OutputConfig-not-required.mdx'

### Run configuration

@include 'builder/vmware/common/RunConfig.mdx'

#### Optional:

@include 'builder/vmware/common/RunConfig-not-required.mdx'

### Driver configuration

#### Optional:

@include 'builder/vmware/common/DriverConfig-not-required.mdx'

### Tools configuration

#### Optional:

@include 'builder/vmware/common/ToolsConfig-not-required.mdx'

### VMX configuration

#### Optional:

@include 'builder/vmware/common/VMXConfig-not-required.mdx'

### Communicator configuration

#### Optional common fields:

@include 'packer-plugin-sdk/communicator/Config-not-required.mdx'

#### Optional SSH fields:

@include 'packer-plugin-sdk/communicator/SSH-not-required.mdx'

#### Optional WinRM fields:

@include 'packer-plugin-sdk/communicator/WinRM-not-required.mdx'

## Shutdown Configuration

@include 'packer-plugin-sdk/shutdowncommand/ShutdownConfig-not-required.mdx'

## Boot Configuration

@include 'packer-plugin-sdk/bootcommand/BootConfig.mdx'

@include 'packer-plugin-sdk/bootcommand/VNCConfig.mdx'

-> **Note**: for the `HTTPIP` to be resolved correctly, your VM's network
configuration has to include a `hostonly` or `nat` type network interface.
If you are using this feature, it is recommended to leave the default network
configuration while you are building the VM, and use the `vmx_data_post` hook
to modify the network configuration after the VM is done building.

#### Optional:

@include 'packer-plugin-sdk/bootcommand/VNCConfig-not-required.mdx'

@include 'packer-plugin-sdk/bootcommand/BootConfig-not-required.mdx'

For more examples of various boot commands, see the sample projects from our
[community templates page](/community-tools#templates).

```json
{
  "builders": [
    {
      "type": "vmware-vmx",
      "boot_key_interval": "10ms",
      ...
    }
  ]
}
```

Example boot command. This is actually a working boot command used to start an
Ubuntu 12.04 installer:

```text
[
  "<esc><esc><enter><wait>",
  "/install/vmlinuz noapic ",
  "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
  "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
  "hostname={{ .Name }} ",
  "fb=false debconf/frontend=noninteractive ",
  "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
  "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
  "initrd=/install/initrd.gz -- <enter>"
]
```

For more examples of various boot commands, see the sample projects from our
[community templates page](/community-tools#templates).

@include 'builders/building_on_remote_vsphere_hypervisor.mdx'
