vagrantvirtual-machinevirtualbox

A VirtualBox machine with the name 'homestead' already exists


Since homestead 2.0 homestead laravel has not been working

I don't know why 'homestead init' creates a Homestead.yaml file in mydirectory/.homestead and not in the project directory. Homestead up OR Vagrant up create the following message

A VirtualBox machine with the name 'homestead' already exists.

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
A VirtualBox machine with the name 'homestead' already exists.
Please use another name or delete the machine with the existing
name, and try again.

Solution

  • I solved by using vboxmanage to get the ID of the VM.

    $ vboxmanage list vms
    "my-vm" {c700b8b6-b766-4638-871b-736b44b7db18}
    

    Copy the ID of the desired VM (the c700…db18 string) into the contents of ~/.vagrant/machines/default/virtualbox/id. Save the file then run vagrant up to get the vm working without having to destroy it.