Apple - macOS partition disappered after installing windows 10 using bootcamp

If you use APFS, then your macOS boot volume may not appear as a choice in the Windows Boot Camp Control Panel pane. The following procedure can be used to fix this problem.

Since the Windows Boot Camp software can detect bootable "Mac OS Extended (Journaled)" volumes, the follow instructions create such a volume. Instead of placing macOS in the volume, a third party boot manager, called rEFInd, will be substituted. This boot manager will then be configured to silently boot the macOS stored in the APFS container. Finally, macOS will be instructed to not automatically mount this new volume at startup.

Below are the steps. The commands need to be entered into a Terminal application window.

  1. Create the new volume. The diskutil command, shown below, shrinks the APFS container (170000M, i.e. 170 GB) by 300 MB (169700M) and creates the new 300 MB "Mac OS Extended (Journaled)" volume labeled "Macintosh HD via rEFInd".

    sudo diskutil ap resizeContainer disk1 169700M JHFS+ "Macintosh HD via rEFInd" 0
    

    After the command completes, restart the Mac.

    Note: If you get an error message which includes the phrase "perhaps caused by APFS Snapshot usage by Time Machine", then see the question: 200GB unused, but can't change APFS container size due to minimum requirement.

  2. Download the rEFInd Boot Manager software from this SourceForge web site. Enter the following commands to install the software to the "Macintosh HD via rEFInd" volume.

    cd ~/Downloads/refind-bin-0.11.2
    ./refind-install --ownhfs /dev/disk0s3
    

    Note: The error message Could not set boot device property: 0xe00002bc was expected and can be ignored.

  3. Configure the TextEdit application. Open TextEdit, then navigate to the "Preferences..." window. Uncheck all the "Options", as shown below. When finished, quit TextEdit.

    y1

  4. Use the command below to navigate to the folder containing the refind.conf file.

    cd "/Volumes/Macintosh HD via rEFInd/System/Library/CoreServices"
    

    Make a backup copy of this file.

    sudo cp refind.conf refind.conf.orignal
    

    Add write permissions to the CoreServices folder and the refind.conf file.

    sudo  chmod  a+w  .  refind.conf
    

    Open the file in the TextEdit application.

    open -e refind.conf
    
  5. Add the following lines to the end of the refind.conf file. You should be able to just cut and paste these lines. When finished, save the changes, then quit TextEdit.

    #
    # Added to make rEFInd silent. 
    #
    menuentry "Macintosh HD via rEFInd" {
        icon \System\Library\CoreServices\icons\os_mac.png
        volume "Macintosh HD"
        loader \System\Library\CoreServices\boot.efi
        ostype MacOS
        graphics on
    }
    timeout -1
    hideui all
    scanfor manual
    

    Note: If you are using encryption, then see the update to this step shown below.

  6. (Optional) Enter the following commands to modify the /etc/fstab file. This entry will instruct macOS not to mount the volume labeled "Macintosh HD via rEFInd" at startup.

    sudo bash 
    echo >>/etc/fstab
    echo "LABEL=Macintosh\040HD\040via\040rEFInd none hfs rw,noauto" >>/etc/fstab    
    exit
    

    Note: The character sequence \040 is just the octal representation of the space character.

    When finished, restart the Mac.

Now when choosing Boot Camp from the Control Panel, you should get something similar to what is shown below.

capture1

Update to Step 5 for an Encrypted macOS

Enter the command given below to get identifier of the booter disk.

diskutil info "Macintosh HD" | grep "Booter Disk:"

Your output should be similar to what is shown below.

   Booter Disk:              disk1s2

Use the identifier to get the boot disk volume name, as shown below.

diskutil info disk1s2 | grep "Volume Name:"

Your output should be similar to what is shown below.

   Volume Name:              Preboot

Use the macOS volume name to get the volume UUID, as shown below.

diskutil info "Macintosh HD" | grep "Volume UUID:"

Your output should be similar to what is shown below.

   Volume UUID:              2E0E6320-5D0A-4181-B465-ABFF2CBBFC27

Replace the volume with the boot disk volume name and add the volume UUID to the path of the loader, as shown below.

    #
    # Added to make rEFInd silent. 
    #
    menuentry "Macintosh HD via rEFInd" {
        icon \System\Library\CoreServices\icons\os_mac.png
        volume "Preboot"
        loader \2E0E6320-5D0A-4181-B465-ABFF2CBBFC27\System\Library\CoreServices\boot.efi
        ostype MacOS
        graphics on
    }
    timeout -1
    hideui all
    scanfor manual

Here the assumption has been made that there are no other APFS containers with a bootable macOS installed. If you do have another container, then by boot disk volume names may be the same. In this case, you will need to rename one of of the volumes. To change the volume name in this example from Preboot to Internal Preboot, enter the following commands.

First, enter the command shown below to mount the volume.

diskutil mount disk1s2

Your output should be similar to what is shown below.

Volume My Preboot on disk1s2 mounted

Second, enter the command shown below to rename the volume.

diskutil rename disk1s2 "Internal Preboot"

Your output should be similar to what is shown below.

Volume on disk1s2 renamed to Internal Preboot

Finally, enter the command shown below to unmount the volume.

diskutil unmount disk1s2

Your output should be similar to what is shown below.

Volume Internal Preboot on disk1s2 unmounted

The lines added to the end of the refind.conf file would then need to appear as shown below.

    #
    # Added to make rEFInd silent. 
    #
    menuentry "Macintosh HD via rEFInd" {
        icon \System\Library\CoreServices\icons\os_mac.png
        volume "Internal Preboot"
        loader \2E0E6320-5D0A-4181-B465-ABFF2CBBFC27\System\Library\CoreServices\boot.efi
        ostype MacOS
        graphics on
    }
    timeout -1
    hideui all
    scanfor manual