Mac vmware

原文链接:

http://www.pengdaiwu.com/2016/10/27/install-macos-sierra-on-vmware/

使用 VMware 安装 macOS Sierra 虚拟机

下载系统安装包

先在 Mac 电脑或虚拟机中访问 AppStore 下载 Sierra 的安装包。下载下来的安装包名称为 “Install macOS Sierra.app”

制作系统安装包 ISO 文件

访问 geerlingguy/macos-virtualbox-vm,参考其生成 ISO 文件的脚本(见文末)。

安装 VMware 最新版本

下载免费的 VMware Workstation Player 或下载收费的 VMware Workstation Pro最新版本并安装。以下是可用的注册号:

  • 5A02H-AU243-TZJ49-GTC7K-3C61N
  • VF5XA-FNDDJ-085GZ-4NXZ9-N20E6
  • UC5MR-8NE16-H81WY-R7QGV-QG2D8
  • ZG1WH-ATY96-H80QP-X7PEX-Y30V4
  • AA3E0-0VDE1-0893Z-KGZ59-QGAVF

解锁 VMware 以支持安装 macOS 虚拟机

VMware Player 默认是不支持安装 macOS 虚拟机的。下载 Unlocker 2.0.8 ,以管理员身份运行 win-install.cmd,即可解锁成功。

创建虚拟机

以常规方式创建虚拟机即可。系统选择 macOS 10.12 Sierra。虚拟光盘选择提前做好的系统安装盘 ISO 文件,CPU 设为 4 核、内存 4GB、硬盘 60GB。

Hack

创建好的虚拟机不能正常启动,需要编辑 vmx 配置文件。将 virtualHW.version值改为 10 或者增加一行配置 smc.version = "0",推荐用后一种方法。

将虚拟机伪装成真实的 Mac 设备

参考 http://www.insanelymac.com/forum/topic/292170-how-to-spoof-real-mac-in-vmware/

编辑 vmx 配置,增加以下行:

board-id.reflectHost = "FALSE"
board-id = "MAC-F22589C8"
hw.model.reflectHost = "FALSE"
hw.model = "MacBookPro6,2"
serialNumber.reflectHost = "FALSE"
serialNumber = "RM129481AGW"
smbios.reflectHost = "FALSE"

其中 board-id.reflectHost 的值默认是 TRUE。需要将原先的设置删掉,否则会报错。hw.model 的值可以从 Apple 官网 查询,想设置成哪种 Mac 设备都可以。

激活 iMessage

默认 iMessage 是无法在虚拟机上激活的。可以通过以下设置使得 iMessage 可以激活。

编辑 vmx 配置,增加以下行:

efi.nvram.var.ROM.reflectHost = "FALSE"
efi.nvram.var.MLB.reflectHost = "FALSE"
system-id.enable = "TRUE"
efi.nvram.var.ROM = "123456"
efi.nvram.var.MLB = "DONKDONKDONKDONKA"

制作系统安装包 ISO 文件的脚本

#!/bin/bash

#
# This script will create a bootable ISO image from the installer application for El Capitan (10.11) or the new Sierra (10.12) macOS.
# Restructured a bit, and adapted the 10.11 script from this URL:
# https://forums.virtualbox.org/viewtopic.php?f=22&t=77068&p=358865&hilit=elCapitan+iso#p358865
#

#
# createISO
#
# This function creates the ISO image for the user.
# Inputs:  $1 = The name of the installer - located in your Applications folder or in your local folder/PATH.
#          $2 = The Name of the ISO you want created.
#
function createISO()
{
  if [ $# -eq 2 ] ; then
    local installerAppName=${1}
    local isoName=${2}
    local error=0

    # echo Debug: installerAppName = ${installerAppName} , isoName = ${isoName}

    # ==============================================================
    # 10.11 & 10.12: How to make an ISO from the Install app
    # ==============================================================
    echo
    echo Mount the installer image
    echo -----------------------------------------------------------

    if [ -e "${installerAppName}" ] ; then
      echo $ hdiutil attach "${installerAppName}"/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
      hdiutil attach "${installerAppName}"/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
      error=$?
    elif [ -e /Applications/"${installerAppName}" ] ; then
      echo $ hdiutil attach /Applications/"${installerAppName}"/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
      hdiutil attach /Applications/"${installerAppName}"/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
      error=$?
    else
      echo Installer Not found!
      error=1
    fi

    if [ ${error} -ne 0 ] ; then
      echo "Failed to mount the InstallESD.dmg from the instaler at ${installerAppName}.  Exiting. (${error})"
      return ${error}
    fi

    echo
    echo Create ${isoName} blank ISO image with a Single Partition - Apple Partition Map
    echo --------------------------------------------------------------------------
    echo $ hdiutil create -o /tmp/${isoName} -size 8g -layout SPUD -fs HFS+J -type SPARSE
    hdiutil create -o /tmp/${isoName} -size 8g -layout SPUD -fs HFS+J -type SPARSE

    echo
    echo Mount the sparse bundle for package addition
    echo --------------------------------------------------------------------------
    echo $ hdiutil attach /tmp/${isoName}.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
    hdiutil attach /tmp/${isoName}.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build

    echo
    echo Restore the Base System into the ElCapitan ISO image
    echo --------------------------------------------------------------------------
    echo $ asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
    asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase

    echo
    echo Remove Package link and replace with actual files
    echo --------------------------------------------------------------------------
    echo $ rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
    rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
    echo $ cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
    cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/

    echo
    echo Copy macOS ${isoName} installer dependencies
    echo --------------------------------------------------------------------------
    echo $ cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
    cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
    echo $ cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg
    cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg

    echo
    echo Unmount the installer image
    echo --------------------------------------------------------------------------
    echo $ hdiutil detach /Volumes/install_app
    hdiutil detach /Volumes/install_app

    echo
    echo Unmount the sparse bundle
    echo --------------------------------------------------------------------------
    echo $ hdiutil detach /Volumes/OS\ X\ Base\ System/
    hdiutil detach /Volumes/OS\ X\ Base\ System/

    echo
    echo Resize the partition in the sparse bundle to remove any free space
    echo --------------------------------------------------------------------------
    echo $ hdiutil resize -size `hdiutil resize -limits /tmp/${isoName}.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/${isoName}.sparseimage
    hdiutil resize -size `hdiutil resize -limits /tmp/${isoName}.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/${isoName}.sparseimage

    echo
    echo Convert the sparse bundle to ISO/CD master
    echo --------------------------------------------------------------------------
    echo $ hdiutil convert /tmp/${isoName}.sparseimage -format UDTO -o /tmp/${isoName}
    hdiutil convert /tmp/${isoName}.sparseimage -format UDTO -o /tmp/${isoName}

    echo
    echo Remove the sparse bundle
    echo --------------------------------------------------------------------------
    echo $ rm /tmp/${isoName}.sparseimage
    rm /tmp/${isoName}.sparseimage

    echo
    echo Rename the ISO and move it to the desktop
    echo --------------------------------------------------------------------------
    echo $ mv /tmp/${isoName}.cdr ~/Desktop/${isoName}.iso
    mv /tmp/${isoName}.cdr ~/Desktop/${isoName}.iso
  fi
}

#
# installerExists
#
# Returns 0 if the installer was found either locally or in the /Applications directory.  1 if not.
#
function installerExists()
{
  local installerAppName=$1
  local result=1
  if [ -e "${installerAppName}" ] ; then
    result=0
  elif [ -e /Applications/"${installerAppName}" ] ; then
    result=0
  fi
  return ${result}
}

#
# Main script code
#
# See if we can find either the ElCapitan or the 10.12 installer.
# If successful, then create the iso file from the installer.
#

installerExists "Install macOS Sierra.app"
result=$?
if [ ${result} -eq 0 ] ; then
  createISO "Install macOS Sierra.app" "Sierra"
else
  installerExists "Install OS X El Capitan.app"
  result=$?
  if [ ${result} -eq 0 ] ; then
    createISO "Install OS X El Capitan.app" "ElCapitan"
  else
    installerExists "Install OS X Yosemite.app"
    result=$?
    if [ ${result} -eq 0 ] ; then
      createISO "Install OS X Yosemite.app" "Yosemite"
    else
      echo "Could not find installer for Yosemite (10.10), El Capitan (10.11) or Sierra (10.12)."
    fi
  fi
fi
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值