Skip to content

neowu/vz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A lightweight virtual machine tool, for personal use.

only support Apple Silicon and macOS

Features

  • create and run both Linux and MacOS VM
  • run in GUI or detached mode

Usage

Usage: vz <COMMAND>

Commands:
  ls          list vm status
  create      create vm
  run         run vm
  stop        stop vm
  ipsw        get macOS restore image ipsw url
  edit        edit vm (cpu, ram, increase disk image size)
  install     install macOS
  completion  generate shell completion
  help        Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Create

create vm

Usage: vz create [OPTIONS] <NAME>

Arguments:
  <NAME>  vm name

Options:
      --os <OS>      create a linux or macOS vm [default: linux] [possible values: linux, macOS]
      --cpu <CPU>    cpu count [default: 1]
      --ram <RAM>    ram size in gb [default: 1]
      --disk <DISK>  disk size in gb [default: 50]
      --ipsw <IPSW>  macOS restore image file, e.g. --ipsw=UniversalMac_14.5_23F79_Restore.ipsw
  -h, --help         Print help

How to build

./build/build.sh

Install shell completion

# fish
vz completion | tee ~/.config/fish/completions/vz.fish
# zsh
vz completion | sudo tee /usr/local/share/zsh/site-functions/_vz

Rosetta

refer to https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta

# here use debian as example, install binfmt-support
apt install binfmt-support
# mount rosetta directory on startup
sed -i -E '$arosetta /run/rosetta virtiofs rw 0 2' /etc/fstab
# install rosetta via systemd-binfmt.service 
echo ':rosetta:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/run/rosetta/rosetta:FOC' | tee /etc/binfmt.d/rosetta.conf
# to enable AOT cache daemon, or make it as systemd service
/run/rosetta/rosettad daemon &

Notes

Known issues

  • after macos updating, dhcp could broken due to firewall, either restart again, or manually unblock
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd

About

A lightweight virtual machine tool for macOS, rust version

Resources

License

Stars

8 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors