Install dmg mac os bash

Создание загружаемого установщика для macOS

В качестве загрузочного диска для установки операционной системы на компьютер Mac можно использовать внешний диск или дополнительный том.

Эти расширенные инструкции предназначены в первую очередь для системных администраторов и других пользователей, имеющих опыт работы с командной строкой. Загружаемый установщик не требуется для обновления macOS или переустановки macOS, но он может оказаться удобен, если требуется выполнить установку на несколько компьютеров, не загружая установщик заново каждый раз.

Что нужно для создания загружаемого установщика:

  • USB-накопитель или другой дополнительный том, отформатированный в Mac OS Extended, на котором есть не менее 14 ГБ свободного пространства;
  • загруженный установщик для macOS Big Sur, Catalina, Mojave, High Sierra или El Capitan.

Загрузка macOS

  • Загрузка macOS Big Sur, macOS Catalina, macOS Mojave или macOS High Sierra
    Эти элементы загружаются в папку «Программы» в виде приложения с именем «Установка macOS [ название версии ]». Если после загрузки запустится установщик, завершите его работу без продолжения установки. Чтобы получить подходящий установщик, выполняйте загрузку с компьютера Mac, на котором используется macOS Sierra 10.12.5 или более поздней версии либо El Capitan 10.11.6. Корпоративным администраторам следует производить загрузку с сайта Apple, а не с сервера обновления ПО, размещенного в локальной сети.
  • Загрузка OS X El Capitan
    В результате этого действия загрузится образ диска с именем InstallMacOSX.dmg. На компьютере Mac, совместимом с El Capitan, откройте образ диска и запустите с него установщик с именем InstallMacOSX.pkg. Приложение с именем «Установка OS X El Capitan» будет установлено в папку «Программы». Загружаемый установщик создается именно из этого приложения, а не из образа диска или установщика .pkg.

Использование команды createinstallmedia в приложении «Терминал»

  1. Подключите USB-накопитель или другой том, используемый для загружаемого установщика.
  2. Откройте приложение «Терминал» в подпапке «Утилиты» папки «Программы».
  3. Введите или вставьте в приложение «Терминал» одну из следующих команд. Предполагается, что установщик находится в папке «Программы», а имя MyVolume обозначает USB-накопитель или другой используемый вами том. Укажите вместо MyVolume имя своего тома в следующих командах.

Big Sur*:

Catalina*:

Mojave*:

High Sierra*:

El Capitan:

* Если на компьютере Mac установлена операционная система macOS Sierra или более ранней версии, включите аргумент —applicationpath и путь установки аналогично тому, как это делается в случае команды для El Capitan.

После набора команды

  1. Нажмите «Ввод», чтобы ввести команду.
  2. При появлении запроса введите пароль администратора и нажмите клавишу «Ввод» еще раз. При вводе пароля приложение «Терминал» не отображает вводимые символы.
  3. При появлении запроса нажмите клавишу Y , чтобы подтвердить удаление всех данных на томе, затем клавишу «Ввод». Приложение «Терминал» показывает прогресс по мере стирания тома.
  4. После стирания тома может быть отображено предупреждение о том, что приложению «Терминал» требуется доступ к файлам на съемном томе. Нажмите «OK», чтобы продолжить копирование.
  5. Когда приложение «Терминал» сообщит о завершении процесса, имя тома будет совпадать с именем загруженного установщика, например «Установка macOS Big Sur». После этого можно закрыть приложение «Терминал» и извлечь том.
Читайте также:  Почему линукс не подвержен вирусам

Источник

coolaj86 / Create a Bootable MacOS Recovery USB with Linux.md

How to create a Bootable MacOS Recovery USB from Linux

If your Mac is out-of-order or you otherwise cannot download macOS from the App Store, you can still create a bootable OS X recovery USB, and you can use that to create an Installer USB.

The downloads used in this process are legal and freely avaliable — including disk images directly from Apple’s IT support pages, and open source utilities for extracting and converting pkg, dmg, and HFS+.

No hackery. No hackintosh-ery.

This process works for

  • macOS Catalina (10.15)
  • macOS Mojave (10.14)
  • macOS High Sierra (10.13)
  • macOS Sierra (10.12)
  • OS X El Capitan (10.11)
  • OS X Yosemite (10.11)

In all cases you should first download the El Capitan Installer, as a direct download from Apple (no App Store).

The OS X Yosemite and macOS Sierra images should also work, but you might have trouble getting macOS Sierra to boot in VirtualBox.

Recovery USB vs Installer USB

This is a 3-step process:

  1. Create a Recovery ISO with Linux
  2. Create an El Capitan Installer ISO with VirtualBox from the Recovery image
  3. Create other Installer USBs from El Capitan in VirtualBox

Create the Recovery ISO

The Apple download contains a recovery image called BaseSystem.dmg which needs to be copied to a correctly partitions and formatted recovery USB or ISO.

  1. Download the OS X El Capitan installer
    • Note for Windows users running Linux from VirtualBox:
      • you already downloaded InstallOSX.dmg to your USB drive, so skip this step
    • Visit Apple’s official «How to upgrade to El Capitan» documentation
    • Click «Download OS X El Capitan» in Step 4
    • InstallOSX.dmg will be about 6GB in your Downloads folder
  2. Install HFS+ tools for Linux
    • See install-mac-tools.sh below
    • Note for Windows users running Linux from VirtualBox:
      • choose to download to your USB drive, NOT Downloads
      • run the script from your USB drive, NOT Downloads
    • Right-Click on the view Raw link, choose Save as , and select the Downloads folder
    • Open a Terminal and run bash install-mac-tools.sh from the Downloads folder

You can of course run each command of the scripts by hand, but since it’s deeply nested ( .dmg containing a .pkg containing another .dmg with another .dmg inside), and requires loopback mounts, it’s a rather tedious and mundane process.

Boot the Recovery ISO

You will need a 32GB+ USB drive, ExFAT formatted.

You should copy ElCapitanInstallESD.dmg from Downloads to your USB drive.

# #######################################################################################################################
# bootableinstaller.com #
# #######################################################################################################################
set -e
set -u
set -x
# Install HFS+ and dmg dependencies
if ! [ $( command -v mkfs.hfsplus ) ] || ! [ $( command -v dmg2img ) ] ; then
# Note: hfsplus and hfsutils are old and not necessary
# Note: mac-fdisk (mac-fdisk-cross) is useful for debugging, but not required
sudo apt install -y hfsprogs dmg2img
fi
# Install xar
if ! [ -f » xar/xar/src/xar » ] ; then
echo » Installing XAR from https://github.com/mackyle/xar.. «
sudo apt install -y build-essential autoconf
sudo apt install -y libxml2-dev libssl-dev git
rm -rf xar/
git clone https://github.com/mackyle/xar
pushd xar/xar
sed -i.bak ‘ s/OpenSSL_add_all_ciphers/OPENSSL_init_crypto/g ‘ configure.ac
./autogen.sh —prefix=/usr/local
make
sudo make install
popd
fi
# #######################################################################################################################
# bootableinstaller.com #
# #######################################################################################################################
# Put bash in «strict mode»
set -u
set -e
if [ -f » ./el-capitan-rescue.iso » ] ; then
echo » ‘el-capitan-rescue.iso’ already exists «
exit 0
fi
# Show commands as they are executed
set -x
my_installesd= » ./ElCapitanInstallESD.img «
if ! [ -f » ./InstallESD.img » ] ; then
my_installesd= » ./InstallESD.img «
fi
if ! [ -f » $my_installesd » ] ; then
if ! [ -f » ./InstallMacOSX/InstallMacOSX.pkg/InstallESD.dmg » ] ; then
if ! [ -f » ./InstallMacOSX.img » ] ; then
if ! [ -f » ./InstallMacOSX.dmg » ] ; then
echo » Error: ‘InstallMacOSX.dmg’ doest not exist. «
echo » Go to https://support.apple.com/en-us/HT206886 «
echo » In step 4 click ‘Download OS X El Capitan’ «
fi
# decompresses into a dd-like image
dmg2img InstallMacOSX.dmg -o ./InstallMacOSX.img
chmod a-w ./InstallMacOSX.img
# rm InstallMacOSX.dmg
fi
my_fullosx= $( sudo losetup —list | (grep InstallMacOSX.img || true) )
if ! [ -f » /mnt/InstallMacOSX/InstallMacOSX.pkg » ] ; then
my_fullosx= $( sudo losetup —partscan —show —find InstallMacOSX.img )
echo » $my_fullosx «
sudo fdisk -l » $my_fullosx «
ls -l » $my_fullosx » p *
sudo partprobe $my_fullosx
sudo mkdir -p /mnt/InstallMacOSX
sudo mount » $my_fullosx » p2 -o ro,noatime /mnt/InstallMacOSX
fi
echo » Extracting /mnt/InstallMacOSX/InstallMacOSX.pkg «
mkdir -p ./InstallMacOSX.tmp.d/
pushd ./InstallMacOSX.tmp.d/
# LD_LIBRARY_PATH=../xar/xar/lib ../xar/xar/src/xar -xvf /mnt/InstallMacOSX/InstallMacOSX.pkg
# TODO maybe use pzip / 7zip instead?
xar -xvf /mnt/InstallMacOSX/InstallMacOSX.pkg
popd
mv ./InstallMacOSX.tmp.d ./InstallMacOSX
sudo umount /mnt/InstallMacOSX
sudo losetup -d » $my_fullosx «
fi
if ! [ -f » ./ElCapitanInstallESD.img » ] ; then
dmg2img ./InstallMacOSX/InstallMacOSX.pkg/InstallESD.dmg -o ./ElCapitanInstallESD.img
chmod a-w ./ElCapitanInstallESD.img
fi
my_installesd=./ElCapitanInstallESD.img
# TODO it’s now safe to remove the big fat InstallMacOSX.*mg and ./InstallMacOSX/
fi
my_esd= $( sudo losetup —list | (grep InstallESD.img || true) | cut -d ‘ ‘ -f1 )
if ! [ -f » /mnt/InstallESD/BaseSystem.dmg » ] ; then
my_esd= $( sudo losetup —partscan —show —find » $my_installesd » )
echo » $my_esd «
sudo fdisk -l » $my_esd «
ls -l » $my_esd » p *
sudo partprobe $my_esd
sudo mkdir -p /mnt/InstallESD
sudo mount » $my_esd » p2 -o ro,noatime /mnt/InstallESD
fi
if ! [ -f » ./BaseSystem.img » ] ; then
dmg2img /mnt/InstallESD/BaseSystem.dmg -o ./BaseSystem.img
chmod a-w ./BaseSystem.img
fi
my_base= $( sudo losetup —list | grep BaseSystem.img | cut -d ‘ ‘ -f1 )
if [ -z » $my_base » ] ; then
my_base= $( sudo losetup —partscan —show —find ./BaseSystem.img )
echo » $my_base «
sudo fdisk -l » $my_base «
ls -l » $my_base » p *
sudo partprobe $my_base
fi
my_empty= $( ls empty * img.bz2 | sort | head -1 )
cp -rp » $my_empty » el-capitan-rescue.dd.img.bz2
bunzip2 el-capitan-rescue.dd.img.bz2
my_dd= $( sudo losetup —partscan —show —find el-capitan-rescue.dd.img )
echo » $my_dd «
sudo mac-fdisk -l » $my_dd «
ls -l » $my_dd » p *
sudo dd if= » $my_base » p1 of= » $my_dd » p2 bs=128M status=progress
sudo losetup -d » $my_dd «
mv el-capitan-rescue.dd.img el-capitan-rescue.iso
sudo umount /mnt/InstallESD
sudo losetup -d » $my_esd «
chmod a-w ./el-capitan-rescue.iso
echo » el-capitan-rescue.iso «

This comment has been minimized.

Copy link Quote reply

stuft2 commented Nov 15, 2020

I had two other dependencies I had to install before the script would run successfully:

  1. Download empty*img.bz2 from bootableinstaller
  2. Install mac-fdisk: sudo apt-get install mac-fdisk-cross

This comment has been minimized.

Copy link Quote reply

devalexandre commented Dec 9, 2020

I try and not work 🙁
I get InstallMacOSX.dmg past in USB and run scripts only mount e not generate el-capitan-rescue.iso

This comment has been minimized.

Copy link Quote reply

mimi89999 commented Jan 14, 2021

Hello,
I found a much easier and faster way to create a recovery. Tested with Catalina.

  1. Download https://github.com/kholia/OSX-KVM/blob/master/fetch-macOS.py
  2. Run it and select in the menu any version up to 10.15.x macOS Catalina
  3. Wait for BaseSystem.dmg to download in the same folder you run the script
  4. Run dmg2img BaseSystem.dmg . It will convert the dmg to a raw disk image BaseSystem.img
  5. Write the image to a USB key using dd or GNOME disks
  6. Boot your Mac from the USB key. It will boot into recovery where you will have the option to install mac os.

This comment has been minimized.

Copy link Quote reply

linconrezende commented May 6, 2021 •

I had two other dependencies I had to install before the script would run successfully:

  1. Download empty*img.bz2 from bootableinstaller
  2. Install mac-fdisk: sudo apt-get install mac-fdisk-cross

Awesome!! First, thank you!
I had an error «xar command not found», for some reason the install-mac-tools.sh script didn’t really installed.
I’m on Ubuntu 20.04.2 LTS x
I solved it by doing:

After that, I had another output: «512: failed to use device: No such device»
Then I realized that I needed the empty*img.bz2 from bootableinstaller
After that, I got another error: mac-fdisk: command not found which I solved by installing it. On the script it says: «not required» but in my case I wouldn’t work without it (I think)

After all that, I deleted all the files, then I started again. It worked!
I just don’t know yet why the dmg file is over 6Gig and the final iso is 2Gig.
I’ll create a bootable USB and if it works I’ll post here. Thanks

Edit I decided to describe a little bit about what I’ve done that could help

It did what it is soposed to do, but in my case, it didn’d worked because I had a wrong DMG file, that has a update, not a full base system.
I’ve been searching on the internet for a few days now, and the only and most simple was this:
https://www.addictivetips.com/ubuntu-linux-tips/create-a-macos-installation-disk-on-linux/
Convert the image to a ubuntu friendly image

and finally, the code bellow to flash the iso into the USB drive.
sudo dd if=/path/to/image_file.iso of=/dev/sdd
It took less than 10 minutes to convert and 30 minutes to flash it into the USB drive.

I booted on my macbook air 2011, and I installed Mac OS X Lion.
To, only then, update it to the El Capitan and I finally I gave up, because I’ve never seen a macbook that slow (taking abount 10 minutes to turn on every single time a normal shutdown). It probably has some isues with the RAM or the SSD..

But anyways. I’ve learned A LOT of new things! It was fun.

Источник

Читайте также:  Центр обеспечения безопасности windows назначение
Оцените статью