Answers: <p>There doesn't seem to be a "proper" way of unregistering a virtual machine sadly.</p>
  
  <p>I went around this by stopping the virtual machine using <code>vmrun</code> in Fusion, deleting the source folder of the VM, and restarting Fusion so that the application registers that the VM is not there anymore.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-10-30T17:16:23.167Z
Answers: 2017-10-30T17:16:23.167Z
Answers: Rekovni
Body: <p>Is there anyway of unregistering a virtual machine on OSX using the command line with VMware Fusion (so that the VM can then be deleted)?</p>
  
  <p>I've looked around, and found <a href="https://communities.vmware.com/thread/560093" rel="nofollow noreferrer">this</a> thread, which suggests </p>
  
  <blockquote>
    <p>manually remove the VM from inventory before running the DeleteVM command</p>
  </blockquote>
  
  <p>But where is this inventory? Or is there a better way of unregistering a machine via the command line?</p>
  
Comments: CC BY-SA 3.0
Comments: 2017-09-27T15:28:40.020Z
Comments: Did you check the [vmrun](https://www.vmware.com/support/developer/vix-api/vix112_vmrun_command.pdf) utility and the [VIX API](https://www.vmware.com/support/developer/vix-api/) ? BTW Fusion as workstation doesn't support registration, that's an esx esxi capability to keep an inventory of VMs). This sounds like you're trying to solve a XY problem here
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-09-27T15:31:45.973Z
Comments: @Tensibai vmrun doesn't support unregistering, and the VIX API doesn't seem to work with Fusion (source: https://www.vmware.com/support/developer/vix-api/vix113_reference/index2.html)
Comments: Rekovni
Comments: CC BY-SA 3.0
Comments: 2017-09-27T15:43:44.730Z
Comments: That's the point... in brief "No there's no cli way, you have to go though the Fusion UI"
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-09-27T15:54:09.740Z
Comments: I see, I thought the workaround mentioned in the thread about manually removing the VM from the inventory could work...
Comments: Rekovni
Comments: CC BY-SA 3.0
Comments: 2017-09-27T16:25:35.130Z
Comments: The thread say exactly that, remove from the ui, that said I didn't thought fusion kept an inventory, deleting a stopped machine should work
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-09-27T16:27:31.507Z
Comments: Ah, the inventory literally meant the UI in that scenario... I did see another thread (https://communities.vmware.com/thread/551152), but it didn't mention the location for an inventory file for OSX, so it might be the case that fusion doesn't have that inventory file
Comments: Rekovni
Comments: CC BY-SA 3.0
Comments: 2017-09-27T20:18:39.947Z
Comments: As far as I remember that's just Fusion/workstation keep a handle on the vmx file, there's no inventory, just a list of files/folders
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-09-27T21:07:05.793Z
Comments: Is there no other way of manipulating Fusion to unregister a VM then? :'(
Comments: Rekovni
Comments: CC BY-SA 3.0
Comments: 2017-09-28T05:33:22.657Z
Comments: We're back at the XY problem, why do you wish to do this unregister on first place? Maybe there's another approach to make the overall task if we take a step back and look at the full picture then maybe tools like packer could be of help and have a solution for you
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-09-28T08:23:52.757Z
Comments: I'm trying to automate creation and deletion of VMs using Fusion, and just creating a generic python library for that. Managed to do it with Parallels, so was hoping to achieve something similar with Fusion... Maybe an alternative of deleting the VM would be to just delete the `.vmware` file perhaps?
Comments: Rekovni
Comments: CC BY-SA 3.0
Comments: 2017-09-28T08:39:31.643Z
Comments: you have a good chance of hitting the same problem, a handle still being kept on the file and as such preventing its deletion.
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-09-28T08:49:25.980Z
Comments: Hmm, can remove with `sudo rm -R /path/to/.vmware` file, but the VM can still be seen in the Fusion library, and you can't manually remove it from there...
Comments: Rekovni
Tags: <vmware><vmware-fusion>
Title: Unregister a VM within VMware Fusion from command line
UserDisplayName: Rekovni
ThreadText: # Unregister a VM within VMware Fusion from command line
  
  (Asked by: username_0 on 2017-09-27)
  
  Is there anyway of unregistering a virtual machine on OSX using the command line with VMware Fusion (so that the VM can then be deleted)?
  
  I've looked around, and found [this](https://communities.vmware.com/thread/560093) thread, which suggests
  
  > manually remove the VM from inventory before running the DeleteVM command
  
  But where is this inventory? Or is there a better way of unregistering a machine via the command line?
  
  **Tags:** vmware, vmware-fusion
  
  > **Comments:**
  > **username_1**: Did you check the [vmrun](https://www.vmware.com/support/developer/vix-api/vix112_vmrun_command.pdf) utility and the [VIX API](https://www.vmware.com/support/developer/vix-api/) ? BTW Fusion as workstation doesn't support registration, that's an esx esxi capability to keep an inventory of VMs). This sounds like you're trying to solve a XY problem here  
  > **username_0**: @username_1 vmrun doesn't support unregistering, and the VIX API doesn't seem to work with Fusion (source: https://www.vmware.com/support/developer/vix-api/vix113_reference/index2.html)  
  > **username_1**: That's the point... in brief "No there's no cli way, you have to go though the Fusion UI"  
  > **username_0**: I see, I thought the workaround mentioned in the thread about manually removing the VM from the inventory could work...  
  > **username_1**: The thread say exactly that, remove from the ui, that said I didn't thought fusion kept an inventory, deleting a stopped machine should work  
  > **username_0**: Ah, the inventory literally meant the UI in that scenario... I did see another thread (https://communities.vmware.com/thread/551152), but it didn't mention the location for an inventory file for OSX, so it might be the case that fusion doesn't have that inventory file  
  > **username_1**: As far as I remember that's just Fusion/workstation keep a handle on the vmx file, there's no inventory, just a list of files/folders  
  > **username_0**: Is there no other way of manipulating Fusion to unregister a VM then? :'(  
  > **username_1**: We're back at the XY problem, why do you wish to do this unregister on first place? Maybe there's another approach to make the overall task if we take a step back and look at the full picture then maybe tools like packer could be of help and have a solution for you  
  > **username_0**: I'm trying to automate creation and deletion of VMs using Fusion, and just creating a generic python library for that. Managed to do it with Parallels, so was hoping to achieve something similar with Fusion... Maybe an alternative of deleting the VM would be to just delete the `.vmware` file perhaps?  
  > **username_1**: you have a good chance of hitting the same problem, a handle still being kept on the file and as such preventing its deletion.  
  > **username_0**: Hmm, can remove with `sudo rm -R /path/to/.vmware` file, but the VM can still be seen in the Fusion library, and you can't manually remove it from there...  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-10-30. Score: 0 | Accepted answer
  
  There doesn't seem to be a "proper" way of unregistering a virtual machine sadly.
  
  I went around this by stopping the virtual machine using `vmrun` in Fusion, deleting the source folder of the VM, and restarting Fusion so that the application registers that the VM is not there anymore.
  
  
  ---
  
  