【笔记】Anka学习笔记

前言

Anka is a suite of software for creating and managing macOS VMs to run on top of Apple hardware and macOS. It enables creation of macOS VMs and integrates with existing container based DevOps workflows for iOS and Native App build & test CI/CD/Automation. Built on the native Apple hypervisor, it utilizes macOS resource scheduling, performance management, and flexibility. Management of VMs is performed with the Anka Virtualization CLI, UI app, and Build Cloud Controller UI or REST APIs.(官网

准备工作

  • .ipsw系统安装包文件:https://ipsw.me

  • 如果是在12.x的MacOS上安装13.x的MacOS虚拟机,需要准备Xcode环境

  • 安装完Xcode后需要同意协议并安装驱动

1
2
3
4
5
sudo xcodebuild -license accept
sudo xcodebuild -runFirstLaunch
for PKG in $(/bin/ls /Applications/Xcode.app/Contents/Resources/Packages/*.pkg); do
sudo /usr/sbin/installer -pkg "$PKG" -target /
done

安装Anka

1
2
3
FULL_FILE_NAME="$(curl -Ls -r 0-1 -o /dev/null -w %{url_effective} https://veertu.com/downloads/anka-virtualization-apple | cut -d/ -f5)"
curl -S -L -o ./$FULL_FILE_NAME https://veertu.com/downloads/anka-virtualization-apple
sudo installer -pkg $FULL_FILE_NAME -tgt /

同意许可协议

  • 如果是Anka BuildAnka Flow需要同意许可协议
1
sudo anka license accept-eula

创建虚拟机

-c 4:指定虚拟机CPU核心数,缺省值为4,推荐3个及以上
-m 4G:指定虚拟机内存大小,缺省值为4G。单位为:KMGT
-d 128G:指定虚拟机硬盘大小,缺省值为128G。单位为:KMGT

1
anka create -a latest <name>
  • 等待虚拟机创建完成

启动虚拟机

<name>:指定虚拟机名称

1
anka start -uv <name>

查看Anka版本

1
anka version

查看可以安装的系统版本

1
anka create -l

查看虚拟机文件位置

  • 系统镜像包默认的下载位置为~/Library/Application Support/Veertu/Anka/img_lib
1
anka config img_lib_dir

删除虚拟机文件

1
anka delete --cache

完成

参考文献

PRIN BLOG
VeertuAnka官方文档