Macbook Air Can Not Start After Trying to Remove Ubuntu
Use the following steps.
-
Boot to the same Recovery Mode used in your question.
-
Enter the following commands. None of these commands alter your Mac. The commands just product diagnostic information, which may be helpful.
sw_vers export LC_CTYPE="ASCII" diskutil unmountdisk disk0 dd if=/dev/disk0 count=1 bs=16 skip=13108482 | vis -cw;echo
Post the output from the above commands to your question.
-
Enter the commands given below.
diskutil unmountdisk disk0 gpt -f add -i 2 -b 409640 -t apfs disk0 diskutil list internal
If the above commands execute successfully, then the name of the APFS volume containing macOS will appear in the output from the command
diskutil list internal
. If not, then post the output from the above commands to your question, post a comment to my answer and wait for my response. Otherwise, proceed. -
Enter the following commands. When entering the commands, use the output from the previously entered
diskutil list internal
command to replacediskXsV
with the identifier for theAPFS Volume
containing macOS and replacediskYsC
with the identifier for theApple_APFS Container
listed as thePhysical Store
for theAPFS Volume
.diskutil info diskXsV | grep "Disk Size" diskutil info diskYsC | grep "Disk Size"
If the output from both commands match, then you are done. Otherwise, proceed.
-
Enter the following commands. When entering the commands, use the output from the previously entered
diskutil info diskXsV | grep "Disk Size"
command to replaceSizeInBlocks
with the disk size in512-Byte-Units
for theAPFS Volume
containing macOS.diskutil unmountdisk disk0 gpt -f remove -i 2 disk0 diskutil unmountdisk disk0 gpt -f add -i 2 -b 409640 -s SizeInBlocks -t apfs disk0
Use of the gpt add
Command
This section can be ignored by the OP (user Gizem Kaya) . This section was added to this answer mainly to address concerns posted by user Jean_JD. The add
command for gpt
includes the -i
, -b
, -s
and -t
command-specific options. The table below explains how the default values are determined when one or more of these options is omitted.
Option | Default If Omitted |
---|---|
-i |
The first partition in the table with a partition type of zero |
-b |
The starting sector number of the first available block of an unused disk space. |
-s |
The largest available size in sectors based on the starting sector number. |
-t |
A partition type UUID value of 48465300-0000-11AA-AA11-00306543ECAC , which is the same as the hfs alias. |
If the case of this answer, the command-specific option -s
was omitted from gpt -f add -i 2 -b 409640 -t apfs disk0
command in step 3. When the OP enters the command, the default value of 384370648
will be used for the size in sectors.