Skip to content

Instantly share code, notes, and snippets.

@nsteele
Last active April 18, 2022 16:23
Show Gist options
  • Save nsteele/735ae3ce751c6e8940f9fc8da4929c4b to your computer and use it in GitHub Desktop.
Save nsteele/735ae3ce751c6e8940f9fc8da4929c4b to your computer and use it in GitHub Desktop.
Convert parallels vm to vagrant
#!/bin/bash
# These instructions/commands intend to allow use of the vagrant command line tools with an existing Parallels virtual machine
# i.e. a .pvm subdirectory in your Parallels directory (~/Parallels/...)
# NOTE!! These instructions disable synced folder /vagrant
# these instructions assume that your newly vagrant-ized box is called provider/mybox
# make vagrant box directory
mkdir ~/.vagrant.d/boxes/prls-VAGRANTSLASH-mybox/1.0/parallels
# We want the newly make "parallels" directory to look like so:
# - parallels
# - - Vagrantfile
# - - metadata.json
# - - mybox.pvm
# Vagrantfile can be left blank
# metadata.json should have following contents:
{"provider":"parallels"}
# mybox.pvm is a symbolic link to the existing .pvm directory, which we call original_box.pvm:
ln -s ~/Parallels/original_box.pvm ~/.vagrant.d/boxes/prls-VAGRANTSLASH-mybox/1.0/parallels/mybox.pvm
# inside the virtual machine, set up the vagrant user:
sudo useradd vagrant # make password "vagrant"
sudo usermod vagrant -a -G sudo # make vagrant a sudoer. Will need to add to more groups as necessary
ssh-copy-id vagrant@<ip address> # set up a password-less ssh login. ip address of virtual machine
sudo visudo # add following to end of the file: vagrant ALL=(ALL) NOPASSWD: ALL
sudo shutdown -h now
# unregister the box. Assuming box name is original_box
prlctl unregister original_box
vagrant init --box-version 1.0 "prls/mybox" "~/.vagrant.d/boxes/prls-VAGRANTSLASH-mybox/1.0/parallels"
# add the following to the generated Vagrantfile
config.vm.box_check_update = false
config.vm.synced_folder ".", "/vagrant", disabled: true
# start your box
vagrant up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment