Installing MacOS Sonoma on HyperV

First I downloaded Sonoma on my Big Sur machine via Software Update:

and tried the following commands:

hdiutil create -o /tmp/Sonoma -size 16384m -volname Sonoma -layout SPUD -fs HFS+J

hdiutil attach /tmp/Sonoma.dmg -noverify -mountpoint /Volumes/Sonoma

sudo /Applications/Install\ macOS\ --volume /Volumes/Sonoma –nointeraction

hdiutil eject -force /Volumes/Install\ macOS\ Sonoma

hdiutil convert /tmp/Sonoma.dmg -format UDTO -o ~/Desktop/Sonoma

mv -v ~/Desktop/Sonoma.cdr ~/Desktop/Sonoma.iso

rm -fv /tmp/Sonoma.dmg

The output was the following:

admin@MacBook-Pro-Admin ~ % hdiutil create -o /tmp/Sonoma -size 16384m -volname Sonoma -layout SPUD -fs HFS+J
created: /tmp/Sonoma.dmg
admin@MacBook-Pro-Admin ~ % hdiutil attach /tmp/Sonoma.dmg -noverify -mountpoint /Volumes/Sonoma
/dev/disk3              Apple_partition_scheme
/dev/disk3s1            Apple_partition_map
/dev/disk3s2            Apple_HFS                       /Volumes/Sonoma
admin@MacBook-Pro-Admin ~ % sudo /Applications/Install\ macOS\ --volume /Volumes/Sonoma –nointeraction
Ready to start.
To continue we need to erase the volume at /Volumes/Sonoma.
If you wish to continue type (Y) then press return: Y
Erasing disk: 0%... 10%... 20%... 30%... 100%
Copying essential files...
Copying the macOS RecoveryOS...
Making disk bootable...
Copying to disk: 0%... 10%... 20%... 30%... 40%... 50%... 100%
Install media now available at "/Volumes/Install macOS Sonoma"
admin@MacBook-Pro-Admin ~ % hdiutil eject -force /Volumes/Install\ macOS\ Sonoma
"disk3" ejected.
admin@MacBook-Pro-Admin ~ % ll /tmp/Sonoma.dmg
-rw-r--r--@ 1 admin  wheel  17179869184 Apr 14 11:03 /tmp/Sonoma.dmg
admin@MacBook-Pro-Admin ~ % hdiutil convert /tmp/Sonoma.dmg -format UDTO -o ~/Desktop/Sonoma
Reading Driver Descriptor Map (DDM : 0)…
Reading Apple (Apple_partition_map : 1)…
Reading  (Apple_Free : 2)…
Reading disk image (Apple_HFS : 3)…
Elapsed Time: 42.354s
Speed: 386.8Mbytes/sec
Savings: 0.0%
created: /Users/admin/Desktop/Sonoma.cdr
admin@MacBook-Pro-Admin ~ % mv -v ~/Desktop/Sonoma.cdr ~/Desktop/Sonoma.iso
/Users/admin/Desktop/Sonoma.cdr -> /Users/admin/Desktop/Sonoma.iso
admin@MacBook-Pro-Admin ~ % ll ~/Desktop/Sonoma.iso
-rw-r--r--@ 1 admin  staff  17179869184 Apr 14 11:04 /Users/admin/Desktop/Sonoma.iso

Check sum:

$ sha256sum Sonoma.iso
f7464156691c4df49c816137eaa8400fba7495cb93b5ff0dea4c8f1d046e5f60 *Sonoma.iso

After that I realized that I probably do not need this ISO and followed this video and created my virtual machine:

created my disk:

Installed MacOS on MyDisk:

It did not work with Apple ID and I created a regular user:


enabled SSH:


export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
alias ll='ls -lG'
setopt rmstarsilent

export lin=~/repos/examples
alias cl='cd $lin'
alias cb='cd $lin/src/LinesGame'
alias cg='cd $lin/src/LinesGame/LinesGameQt'

Xcode 15.3 gets stuck when I try to select iOS 17.4 platform:

But I was able to run clang from the command line:

~ % sudo xcode-select -s /Applications/
~ % clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/

and at least I was able to compile the following C++ source code:

#include <type_traits>

int main()
    std::common_reference_t<int&, const int&> a = 25;
    return 0;

with the following command:

clang -std=c++20 b.cpp

Reset to factory:

Installing software displays 2 minutes, but actually takes hours:

Downloaded and installed MacPorts:

tried to install Clang 17 with the following commands:

sudo port install clang-17
port contents clang-17
cd /opt/local/libexec/llvm-17/bin
./clang --version
clang version 17.0.6
Target: x86_64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-17/bin/.

and there is also clang-mp-17 in /opt/local/bin folder.

port select --list clang
Available versions for clang:
        none (active)
sudo port select --set clang mp-clang-17
Selecting 'mp-clang-17' for 'clang' succeeded. 'mp-clang-17' is now active.
DevToolsSecurity -enable

System memory settings:

Activity Monitor:

Finally fixed XCode by increasing the number of processors in HyperV settings (it did not worked with 1 processor):

Below I provided all HyperV settings:

XCode started and installed the platforms:

19 Responses to Installing MacOS Sonoma on HyperV

  1. dmitriano says:

    How to Download macOS 14 Sonoma ISO File

  2. dmitriano says:

    This installs Sonoma:
    Installing macOS Sonoma on Hyper-V in Windows 11

  3. dmitriano says:

    Create a bootable installer for macOS

  4. dmitriano says:

    Ready terminal command: xcode-select –install
    Open Settings > General > Software Update
    Run the command, follow the prompt to install, then this will pop up while it’s downloading

  5. dmitriano says:
    ~/Library/Developer/Saved Application State/

  6. dmitriano says:
    Hello RAITON!) Version 14.0.1 is still not working correctly. I’ve been working on version 14.0.1 for two weeks. If you are working on a real project and want stability in working with the program, install version 13.4.1. This is the latest version of Xcode 13 and works perfectly. I went back to version 13.4.1 and have no problems. There is already a beta version of 14.1 (Beta 3), but after version 14.0.1, somehow I don’t really want to update. In my opinion, it will be possible to upgrade to a more stable version of Xcode 14 at the beginning of the new year.

    You can download any version here:

  7. dmitriano says:

    The clock is ticking on Intel Macs, but it’s likely that the last generation of Intel Macs will be on the macOS 15 compatibility list. Here is the current compatibility list for macOS Sonoma: iMac from 2019 and later. Mac Pro from 2019 and later

  8. dmitriano says:
    macOS Sonoma is compatible with these computers:
    MacBook Pro (16-inch, 2023)
    MacBook Pro (14-inch, 2023)
    MacBook Pro (13-inch, M2, 2022)
    MacBook Pro (16-inch, 2021)
    MacBook Pro (14-inch, 2021)
    MacBook Pro (13-inch, M1, 2020)
    MacBook Pro (13-inch, 2020, Two Thunderbolt 3 ports)
    MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)
    MacBook Pro (16-inch, 2019)
    MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports)
    MacBook Pro (15-inch, 2019)
    MacBook Pro (13-inch, 2019, Four Thunderbolt 3 ports)
    MacBook Pro (15-inch, 2018)
    MacBook Pro (13-inch, 2018, Four Thunderbolt 3 ports)

  9. dmitriano says:
    How to install Xcode from xip file

    Double-click the xip file and it will extract the Xcode application. Move Xcode to the Applications folder and you are good to go.

    The App Store should present the Xcode update once you update to Sierra (macOS 10.12). If it doesn’t you can download Xcode directly from the App Store. The preferences are stored in /Users//Library/Preferences and are not impacted by updating the version of Xcode or OS.

  10. dmitriano says:

    Trying to install clang-16 using MacPorts, but clangd along with others aren’t set?
    I guess I could maybe sudo port select –set clangd clangd-mp-16. How do I make sure that everything related to clang-16 is available and being used? The list is quite long. Am I supposed to set all those manually?

  11. dmitriano says:

    Macports Port Select Commands
    To list:

    port select –list python
    To show:

    port select –show python
    To select:

    sudo port select –set python

  12. dmitriano says:

    Build Environment: Xcode 14 (macOS 13 SDK), Xcode 15 (macOS 14 SDK)
    $ xcrun -sdk macosx –show-sdk-path

    Once installed, choosing an Xcode installation is done using the xcode-select tool.

    $ sudo xcode-select –switch /Applications/
    You can inspect the globally selected Xcode installation using the same tool.

    $ xcode-select -print-path
    The xcrun command can then be used to find a particular tool in the toolchain.

    $ xcrun -sdk macosx -find clang
    or show the platform SDK path used when building.

    $ xcrun -sdk macosx –show-sdk-path

  13. dmitriano says:

    Delete Xcode caches, project archives and project build data

  14. dmitriano says:

    How to reinstall macOS from macOS Recovery — Apple Support
    Command + R before Apple logo appears.

  15. dmitriano says:

    Running Mac ios x on a Hyper-V Host – Can it be done?
    you can run OS X in/as a VM on Apple hardware via VMWare ESxi/ESx, which is supported
    Ensure your physical system is an Apple-labeled computer. This is required to install or run OS X 10.8 and OS X 10.9 in a virtual machine.
    iOS apps can be tested using Xamarin Testflight. This is a tool that allows for beta testing of apps on iOS devices. Testflight can be used to test apps on iPhone, iPad, and iPod touch devices. To use Testflight, you will need to have a valid Apple ID. Once you have a valid Apple ID, you can follow the instructions to beta-test an app.

  16. dmitriano says:
    A rather simple solution to simulators and other market alternatives would be BrowserStack App Live for iPhone testing.

    BrowserStack’s Real Device Cloud can help Windows developers test iPhone applications by providing access to a wide range of real devices on the cloud that can be used for testing. This includes a wide range of iPhones, iPads, and different versions of macOS. This means that developers can test their iOS apps on many device-browser-OS combinations, ensuring that they work as intended on all of them.

    Step 1 – Sign up for a free trial of BrowserStack and log in using your credentials.

  17. dmitriano says:
    Constructing a .app bundle
    In Xcode, launch your app project.

    Choose a iOS Device (arm64) or any Generic iOS Device as the device target for your project.

    Choose Clean from the Product menu.

    Go to the Product menu and choose Build.

    Redirect to the generated .app file after going to the Products directory of your Xcode project.

  18. dmitriano says:

    Mac terminal couldn’t access network
    export http_proxy=””

Leave a Reply

Your email address will not be published. Required fields are marked *