# 苹果自动化构建发布

docker run 苹果系统 然后做自动化 xcode 打包发布苹果 app

```bash
#docker run 苹果操作系统笔记
##################################
#linux安装环境
# ARCH
sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison iptables-nft edk2-ovmf
# UBUNTU DEBIAN
sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager libguestfs-tools
# CENTOS RHEL FEDORA
sudo yum install libvirt qemu-kvm
##################################
#自启动 libvirt 和加载 kvm 内核模块
sudo systemctl enable --now libvirtd
sudo systemctl enable --now virtlogd
echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs
sudo modprobe kvm
##################################
#docker run 苹果操作系统
sudo docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e GENERATE_UNIQUE=true \
    -e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist \
    sickcodes/docker-osx:big-sur
#然后在弹出的界面安装初始化 mac 系统
##################################
#重启docker版mac系统
sudo docker ps -a

# xxx 为对应的CONTAINER ID
sudo docker start -ai xxxxx
##################################
#移植Docker版mac镜像
#在docker目录找到对应的镜像文件，然后备份这个文件
sudo find /var/lib/docker -size +10G | grep mac_hdd_ng.img
#使用naked启动，同时附上备份的文件，添加参数-e RAM=6，这个表示虚拟系统使用的内存大小，可以根据自己的硬件环境选择合适的大小
sudo docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v "${PWD}/mac_hdd_ng.img:/image" \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e "NOPICKER=false" \
    -e RAM=6 \
    sickcodes/docker-osx:naked
```

linux安装环境 \
apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager libguestfs-tools

![](/files/hUzaJPTA2Lix0NcltfK0)

自启动 libvirt 和加载 kvm 内核模块\
sudo systemctl enable --now libvirtd \
sudo systemctl enable --now virtlogd \
echo 1 | sudo tee /sys/module/kvm/parameters/ignore\_msrs \
sudo modprobe kvm

![](/files/uMPKFV4LRUcHH6u8lhuW)

\#docker run 苹果操作系统 \
sudo docker run -it\
\--device /dev/kvm\
-p 50922:10022\
-v /tmp/.X11-unix:/tmp/.X11-unix\
-e "DISPLAY=${DISPLAY:-:0.0}"\
-e GENERATE\_UNIQUE=true\
-e MASTER\_PLIST\_URL=<https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist\\>
sickcodes/docker-osx:big-sur\
\#然后在弹出的界面安装初始化 mac 系统

![](/files/zEghBjvnpmZ6sWiEEvaq)

然后docker就会调起 qemu 窗口启动运行 mac 系统

![](/files/xQoFfAI6u0bGOCoD0alg)

![](/files/yZwv1yz5K0ad9wZU1WAq)

![](/files/IBpvM7htRwnpwkXmA3Hq)

![](/files/fnNL06NycNgH68HrxGKO)

迁移 docker 版 mac 系统<br>

![docker stop eee1c12103c6](/files/v38tRoV9Uhu3kpqYIdos)

![备份 mac\_hdd\_ng.img](/files/PoK2wLSyqSiYWx4nTIHC)

![docker rm eee1c12103c6](/files/gX0uv10dhb9xvHxiuPYq)

![docker启动迁移的mac备份](/files/Z7h929y6Xvdq25KWkbSp)

![完美迁移docker 版 mac](/files/bcVsbISJP4mreLmvkw3C)

![迁移启动的mac镜像 /home/ben/mac\_hdd\_ng.img](/files/DhpT1CfSLOAB5QTef53X)

![备份压缩 mac\_hdd\_ng.img 镜像 ，随身携带的 docker 版 mac](/files/vVIJvMBXNB1YUpAmQMRB)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xn--6o0a585a.gitbook.io/devops/zi-dong-hua/ping-guo-zi-dong-hua-gou-jian-fa-bu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
