{"id":6867,"date":"2025-09-30T10:22:28","date_gmt":"2025-09-30T02:22:28","guid":{"rendered":"https:\/\/t.n-years.com\/?p=6867"},"modified":"2025-09-30T10:22:28","modified_gmt":"2025-09-30T02:22:28","slug":"%e6%b5%81%e6%b0%b4%e7%ba%bf%e8%99%9a%e6%8b%9f%e5%8c%96-mac-%e8%b5%84%e6%ba%90%e8%99%9a%e6%8b%9f%e5%8c%96","status":"publish","type":"post","link":"https:\/\/t.n-years.com\/?p=6867","title":{"rendered":"\u6d41\u6c34\u7ebf\u865a\u62df\u5316 MAC \u8d44\u6e90\u865a\u62df\u5316"},"content":{"rendered":"<p>\u5728\u6d41\u6c34\u7ebf\u4e2d\u5b9e\u73b0 macOS \u8d44\u6e90\u7684\u865a\u62df\u5316\u548c\u9ad8\u6548\u7ba1\u7406\uff0c\u9700\u8981\u7ed3\u5408 macOS \u7cfb\u7edf\u7684\u7279\u6b8a\u6027\uff08\u5982\u786c\u4ef6\u9650\u5236\u3001\u8bb8\u53ef\u8981\u6c42\uff09\u548c\u6d41\u6c34\u7ebf\u7684\u81ea\u52a8\u5316\u9700\u6c42\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u7684\u5b9e\u73b0\u65b9\u6848\u548c\u6280\u672f\u7ec6\u8282\uff1a<\/p>\n<h3>\u4e00\u3001macOS \u865a\u62df\u5316\u7684\u6838\u5fc3\u6311\u6218<\/h3>\n<ol>\n<li><strong>\u786c\u4ef6\u9650\u5236<\/strong>\uff1a\u82f9\u679c\u7684 macOS \u8bb8\u53ef\u8981\u6c42\u865a\u62df\u5316\u73af\u5883\u9700\u8fd0\u884c\u5728\u82f9\u679c\u786c\u4ef6\uff08\u5982 Mac \u4e3b\u673a\uff09\u4e0a\uff0c\u65e0\u6cd5\u5728\u666e\u901a x86 \u670d\u52a1\u5668\u4e0a\u539f\u751f\u8fd0\u884c\u3002<\/li>\n<li><strong>\u6027\u80fd\u635f\u8017<\/strong>\uff1aGUI \u76f8\u5173\u4efb\u52a1\uff08\u5982 iOS \u6a21\u62df\u5668\u6d4b\u8bd5\uff09\u5728\u865a\u62df\u5316\u4e2d\u6027\u80fd\u635f\u8017\u8f83\u5927\u3002<\/li>\n<li><strong>\u8d44\u6e90\u9694\u79bb<\/strong>\uff1a\u9700\u786e\u4fdd\u4e0d\u540c\u6d41\u6c34\u7ebf\u4efb\u52a1\u5728\u5171\u4eab macOS \u8d44\u6e90\u65f6\u7684\u73af\u5883\u9694\u79bb\u3002<\/li>\n<li><strong>\u5f39\u6027\u6269\u5c55<\/strong>\uff1a\u52a8\u6001\u8c03\u6574 macOS \u865a\u62df\u8d44\u6e90\u4ee5\u5339\u914d\u6d41\u6c34\u7ebf\u8d1f\u8f7d\u3002<\/li>\n<\/ol>\n<h3>\u4e8c\u3001\u6280\u672f\u9009\u578b\u4e0e\u5b9e\u73b0\u65b9\u6848<\/h3>\n<h4>1. \u5e95\u5c42\u865a\u62df\u5316\u6280\u672f<\/h4>\n<ul>\n<li>\n<p><strong>\u9996\u9009\u65b9\u6848\uff1aApple \u539f\u751f\u865a\u62df\u5316\u6846\u67b6<\/strong><\/p>\n<ul>\n<li>\u57fa\u4e8e <code>Hypervisor.framework<\/code>\uff08macOS \u5185\u7f6e\uff09\u548c <code>Virtualization.framework<\/code>\uff08macOS 11+\uff09\uff0c\u652f\u6301\u521b\u5efa\u8f7b\u91cf\u7ea7 macOS \u865a\u62df\u673a\uff08VM\uff09\u3002<\/li>\n<li>\u5de5\u5177\u94fe\uff1a<code>virt-manager<\/code>\uff08\u56fe\u5f62\u5316\u7ba1\u7406\uff09\u3001<code>xhyve<\/code>\uff08\u547d\u4ee4\u884c\u7ba1\u7406\uff09\u3002<\/li>\n<li>\u4f18\u52bf\uff1a\u6027\u80fd\u63a5\u8fd1\u539f\u751f\uff0c\u652f\u6301 macOS \u6700\u65b0\u7248\u672c\uff08\u5982 Ventura\u3001Sonoma\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5907\u9009\u65b9\u6848\uff1a\u7b2c\u4e09\u65b9\u865a\u62df\u5316\u5de5\u5177<\/strong><\/p>\n<ul>\n<li>Parallels Desktop for Mac\uff1a\u652f\u6301\u5d4c\u5957\u865a\u62df\u5316\uff0c\u9002\u5408\u590d\u6742\u573a\u666f\uff08\u5982\u540c\u65f6\u8fd0\u884c\u591a\u4e2a macOS \u7248\u672c\uff09\u3002<\/li>\n<li>VMware Fusion\uff1a\u7a33\u5b9a\u6027\u597d\uff0c\u652f\u6301\u4e0e Jenkins\u3001GitHub Actions \u7b49\u6d41\u6c34\u7ebf\u5de5\u5177\u96c6\u6210\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>2. \u8d44\u6e90\u6c60\u5316\u7ba1\u7406<\/h4>\n<ul>\n<li><strong>\u7269\u7406\u673a\u96c6\u7fa4<\/strong>\uff1a\u90e8\u7f72\u4e00\u6279 Mac \u4e3b\u673a\uff08\u5982 Mac Mini\u3001Mac Studio\uff09\u4f5c\u4e3a\u5bbf\u4e3b\u673a\uff0c\u7ec4\u6210 macOS \u8d44\u6e90\u6c60\u3002<\/li>\n<li><strong>\u8282\u70b9\u6807\u7b7e\u5316<\/strong>\uff1a\u4e3a\u5bbf\u4e3b\u673a\u6253\u6807\u7b7e\u533a\u5206\u914d\u7f6e\uff0c\u5982 <code>macos-version=13<\/code>\u3001<code>cpu-cores=8<\/code>\u3001<code>has-gpu=true<\/code>\uff08\u7528\u4e8e iOS \u6784\u5efa\uff09\u3002<\/li>\n<li><strong>\u7edf\u4e00\u8c03\u5ea6\u5c42<\/strong>\uff1a\u57fa\u4e8e Kubernetes \u6216\u81ea\u7814\u8c03\u5ea6\u5668\uff0c\u5b9e\u73b0\uff1a\n<ul>\n<li>\u865a\u62df\u673a\u751f\u547d\u5468\u671f\u7ba1\u7406\uff08\u521b\u5efa\u3001\u9500\u6bc1\u3001\u5feb\u7167\uff09\u3002<\/li>\n<li>\u8d44\u6e90\u914d\u989d\u63a7\u5236\uff08\u6bcf\u4e2a VM \u5206\u914d 2 \u6838 CPU\u30014GB \u5185\u5b58\uff09\u3002<\/li>\n<li>\u4efb\u52a1\u4eb2\u548c\u6027\u8c03\u5ea6\uff08\u5982\u6307\u5b9a <code>macos-version=12<\/code> \u7684 VM \u8fd0\u884c\u7279\u5b9a\u4efb\u52a1\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>3. \u6d41\u6c34\u7ebf\u4efb\u52a1\u9694\u79bb<\/h4>\n<ul>\n<li>\n<p><strong>\u865a\u62df\u673a\u5feb\u7167<\/strong>\uff1a\u4e3a\u4e0d\u540c\u4efb\u52a1\u573a\u666f\u521b\u5efa\u57fa\u7840\u5feb\u7167\uff08\u5982\u300c\u5e72\u51c0\u7684 macOS + Xcode 14\u300d\uff09\uff0c\u4efb\u52a1\u542f\u52a8\u65f6\u57fa\u4e8e\u5feb\u7167\u5feb\u901f\u514b\u9686 VM\uff0c\u907f\u514d\u73af\u5883\u6c61\u67d3\u3002<\/p>\n<pre><code class=\"language-bash\"># \u793a\u4f8b\uff1a\u4f7f\u7528virt-clone\u57fa\u4e8e\u5feb\u7167\u521b\u5efa\u4e34\u65f6VM\nvirt-clone --original macos-base-snapshot --name job-12345 --file \/var\/vms\/job-12345.qcow2<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u5bb9\u5668\u5316\u8865\u5145<\/strong>\uff1a\u5728 macOS VM \u5185\u90e8\u4f7f\u7528 Docker Desktop for Mac \u6216 <code>lima<\/code>\uff08\u8f7b\u91cf\u7ea7 Linux \u865a\u62df\u673a\uff09\u8fd0\u884c\u5bb9\u5668\u5316\u4efb\u52a1\uff0c\u8fdb\u4e00\u6b65\u9694\u79bb\u4f9d\u8d56\u3002<\/p>\n<ul>\n<li>\u9002\u5408\u573a\u666f\uff1a\u524d\u7aef\u6784\u5efa\u3001\u811a\u672c\u6267\u884c\u7b49\u65e0 GUI \u4efb\u52a1\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>4. \u4e0e\u6d41\u6c34\u7ebf\u5de5\u5177\u96c6\u6210<\/h4>\n<ul>\n<li>\n<p><strong>GitHub Actions \u96c6\u6210<\/strong>\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528 <code>macos-latest<\/code>  runners\uff08\u57fa\u4e8e\u82f9\u679c\u786c\u4ef6\u7684\u6258\u7ba1 VM\uff09\uff0c\u6216\u901a\u8fc7 <code>self-hosted<\/code> \u6807\u7b7e\u63a5\u5165\u79c1\u6709 macOS \u8d44\u6e90\u6c60\u3002<\/li>\n<li>\u793a\u4f8b\u5de5\u4f5c\u6d41\uff1a\n<pre><code class=\"language-yaml\">jobs:\nios-build:\nruns-on: [self-hosted, macos, xcode-15]  # \u5339\u914d\u79c1\u6709macOS\u8282\u70b9\nsteps:\n  - uses: actions\/checkout@v4\n  - name: Build iOS app\n    run: xcodebuild -project MyApp.xcodeproj -scheme MyApp archive<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Jenkins \u96c6\u6210<\/strong>\uff1a<\/p>\n<ul>\n<li>\u5b89\u88c5 <code>Virtualization Plugin<\/code> \u7ba1\u7406 macOS VM \u6a21\u677f\u3002<\/li>\n<li>\u914d\u7f6e\u300c\u4e91\u8282\u70b9\u300d\u81ea\u52a8\u4ece\u8d44\u6e90\u6c60\u7533\u8bf7 VM\uff0c\u4efb\u52a1\u7ed3\u675f\u540e\u91ca\u653e\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>5. \u5f39\u6027\u4f38\u7f29\u7b56\u7565<\/h4>\n<ul>\n<li><strong>\u57fa\u4e8e\u961f\u5217\u957f\u5ea6<\/strong>\uff1a\u5f53 macOS \u4efb\u52a1\u7b49\u5f85\u6570\u8d85\u8fc7\u9608\u503c\uff08\u5982 5 \u4e2a\uff09\uff0c\u81ea\u52a8\u5728\u7a7a\u95f2 Mac \u5bbf\u4e3b\u673a\u4e0a\u521b\u5efa\u65b0 VM\u3002<\/li>\n<li><strong>\u57fa\u4e8e\u65f6\u95f4\u7a97\u53e3<\/strong>\uff1a\u5728\u6bcf\u65e5\u6784\u5efa\u9ad8\u5cf0\u671f\uff08\u5982 9:00-18:00\uff09\u63d0\u524d\u6269\u5bb9\uff0c\u4f4e\u5cf0\u671f\u81ea\u52a8\u7f29\u5bb9\u3002<\/li>\n<li><strong>\u5de5\u5177\u652f\u6301<\/strong>\uff1a\u7ed3\u5408 <code>Terraform<\/code> \u7ba1\u7406 Mac \u5bbf\u4e3b\u673a\uff08\u5982\u81ea\u52a8\u8d2d\u4e70 AWS EC2 Mac \u5b9e\u4f8b\uff09\uff0c\u914d\u5408 <code>Ansible<\/code> \u521d\u59cb\u5316\u865a\u62df\u5316\u73af\u5883\u3002<\/li>\n<\/ul>\n<h3>\u4e09\u3001\u4f18\u5316\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h3>\n<ol>\n<li>\n<p><strong>\u6027\u80fd\u4f18\u5316<\/strong>\uff1a<\/p>\n<ul>\n<li>\u5bbf\u4e3b\u673a\u4f7f\u7528 SSD \u5b58\u50a8\uff0c\u51cf\u5c11 VM \u542f\u52a8\u548c\u5feb\u7167\u514b\u9686\u65f6\u95f4\u3002<\/li>\n<li>\u5bf9\u9891\u7e41\u6267\u884c\u7684\u4efb\u52a1\uff08\u5982\u5355\u5143\u6d4b\u8bd5\uff09\uff0c\u4fdd\u7559\u957f\u671f\u8fd0\u884c\u7684 VM \u5e76\u5b9a\u671f\u6e05\u7406\uff0c\u907f\u514d\u91cd\u590d\u521b\u5efa\u5f00\u9500\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u8bb8\u53ef\u5408\u89c4<\/strong>\uff1a<\/p>\n<ul>\n<li>\u786e\u4fdd\u6240\u6709 macOS \u865a\u62df\u673a\u4f7f\u7528\u5408\u6cd5\u6388\u6743\uff08\u901a\u8fc7 Apple Developer \u8d26\u53f7\u7ba1\u7406\uff09\u3002<\/li>\n<li>\u907f\u514d\u5728\u975e\u82f9\u679c\u786c\u4ef6\u4e0a\u8fd0\u884c macOS\uff08\u8fdd\u53cd\u82f9\u679c\u8bb8\u53ef\u534f\u8bae\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u76d1\u63a7\u4e0e\u8fd0\u7ef4<\/strong>\uff1a<\/p>\n<ul>\n<li>\u76d1\u63a7\u5bbf\u4e3b\u673a\u8d44\u6e90\u4f7f\u7528\u7387\uff08CPU\u3001\u5185\u5b58\u3001\u78c1\u76d8 I\/O\uff09\u548c VM \u5065\u5eb7\u72b6\u6001\u3002<\/li>\n<li>\u81ea\u52a8\u6e05\u7406\u50f5\u5c38 VM\uff08\u5982\u4efb\u52a1\u8d85\u65f6\u672a\u91ca\u653e\u7684\u8d44\u6e90\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6210\u672c\u63a7\u5236<\/strong>\uff1a<\/p>\n<ul>\n<li>\u4f18\u5148\u4f7f\u7528\u95f2\u7f6e Mac \u8bbe\u5907\u7ec4\u6210\u79c1\u6709\u8d44\u6e90\u6c60\uff0c\u964d\u4f4e\u4e91\u670d\u52a1\u6210\u672c\uff08\u5982 AWS EC2 Mac \u5b9e\u4f8b\u8d39\u7528\u8f83\u9ad8\uff09\u3002<\/li>\n<li>\u5bf9\u975e\u7d27\u6025\u4efb\u52a1\uff08\u5982\u591c\u95f4\u6d4b\u8bd5\uff09\uff0c\u8c03\u5ea6\u5230\u4f4e\u914d VM \u8fd0\u884c\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>\u56db\u3001\u5178\u578b\u5e94\u7528\u573a\u666f<\/h3>\n<ul>\n<li><strong>iOS \u5e94\u7528\u6784\u5efa<\/strong>\uff1a\u5728 macOS VM \u4e2d\u5b89\u88c5 Xcode\uff0c\u6267\u884c <code>xcodebuild<\/code> \u7f16\u8bd1\u548c\u7b7e\u540d\u3002<\/li>\n<li><strong>macOS \u5e94\u7528\u6d4b\u8bd5<\/strong>\uff1a\u8fd0\u884c\u81ea\u52a8\u5316\u6d4b\u8bd5\u6846\u67b6\uff08\u5982 XCUITest\uff09\uff0c\u914d\u5408\u6a21\u62df\u5668\u9a8c\u8bc1\u529f\u80fd\u3002<\/li>\n<li><strong>\u8de8\u5e73\u53f0\u6784\u5efa<\/strong>\uff1a\u5728\u540c\u4e00\u6d41\u6c34\u7ebf\u4e2d\u4e32\u8054 macOS\u3001Linux\u3001Windows \u4efb\u52a1\uff08\u5982 Flutter \u5e94\u7528\u591a\u5e73\u53f0\u6253\u5305\uff09\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6848\uff0c\u53ef\u5728\u6d41\u6c34\u7ebf\u4e2d\u5b9e\u73b0 macOS \u8d44\u6e90\u7684\u865a\u62df\u5316\u7ba1\u7406\uff0c\u5e73\u8861\u5408\u89c4\u6027\u3001\u6027\u80fd\u548c\u8d44\u6e90\u5229\u7528\u7387\uff0c\u6ee1\u8db3\u82f9\u679c\u751f\u6001\u76f8\u5173\u7684 CI\/CD \u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u6d41\u6c34\u7ebf\u4e2d\u5b9e\u73b0 macOS \u8d44\u6e90\u7684\u865a\u62df\u5316\u548c\u9ad8\u6548\u7ba1\u7406\uff0c\u9700\u8981\u7ed3\u5408 macOS \u7cfb\u7edf\u7684\u7279\u6b8a\u6027\uff08\u5982\u786c\u4ef6\u9650\u5236\u3001\u8bb8\u53ef\u8981\u6c42\uff09&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/t.n-years.com\/?p=6867\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[123],"tags":[],"class_list":["post-6867","post","type-post","status-publish","format-standard","hentry","category-123"],"_links":{"self":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6867"}],"version-history":[{"count":1,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6867\/revisions"}],"predecessor-version":[{"id":6868,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6867\/revisions\/6868"}],"wp:attachment":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}