📜 ⬆️ ⬇️

Offline OSX Recovery from Recovery HD



Prehistory


In light of the release of OS X Mavericks Golden Master decided to look at the new beast, installing it on the outdated iMac7.1. The installation was successful, in the usual way from the working system version 10.7. But everything worked very slowly. This mac has experienced more than one OS generation update and a single installation with a “0”. Due to the lack of valuable data - it was decided to put it clean. I reformatted the partition from recovery mode, aka Recovery HD, and here I was in for a nasty surprise and not even one. Details of how to persuade, is no longer a kitty from Cupertino, without access to the Internet and a boot device

First surprise


When installed, Recovery HD was upgraded from version 10.7 to version 10.9, and from this follows the second surprise ...
')

Surprise Two


Internet Recovery is a well-known OSX recovery mechanism over the Internet. Log in to the Apple Store, if OSX is purchased, then the installer will download the necessary files via the Internet. Works like a clock, or rather worked. There is a small problem - the Mavericks are not in the Apple Store yet, and the DMG file with the operating system was obtained from Apple Dev, so it did not work out to restore it in the usual way. " An unknown error has occurred " is what I met when trying to login.
Scratching my turnips, I created a bootable USB flash drive. Then a third surprise awaited me ...

Surprise the third


iMac refuses to see USB as a boot disk, for some incomprehensible (to me) reason. At the same time, Disk Utility, in Recovery mode, sees it normally. Having reset NVRAM, SMC and having played enough with all the flash drives found at home, I decided to try a portable disk. If meekly - see the result of a flash drive. The DVD writers and, most importantly, the 2-ply media was not at hand - I was despondent and crawled to Google.

Casket just opened


The result of a 2-day yaw on specialized forums allowed to install the Mavericks without access to the Internet and without the possibility of downloading from external media.
It's simple, copy the Packages folder to the root of any flash drive with a capacity of more than 4 GB. To do this, you need the downloaded dmg file downloaded from the Apple Dev (or obtained in another way).

You can get this folder like this:


Reboot into recovery mode (with Alt clamped), connect the USB flash drive and start the Terminal


We check the list of devices, we are interested in macHD - the label of my hard drive in iMac and usb-osx - the label of the flash drive with the Packages directory in the root.
-bash-3.2# diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *250.1 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_HFS macHD 249.2 GB disk0s2 3: Apple_Boot Recovery HD 650.0MB disk0s3 ... /dev/disk3 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *7.7 GB disk3 1: EFI EFI 209.7 MB disk3s1 2: Apple_HFS usb-osx 7.4 GB disk3s2 


We look where these devices are mounted (paths are needed to form the installation command below)
 -bash-3.2# mount | grep macHD /dev/disk0s2 on /Volumes/macHD (hfs, local, journaled) -bash-3.2# mount | grep usb-osx /dev/disk3s2 on /Volumes/usb-osx (hfs, local, nodev, nosuid, noowners) 


Run the installation process.
 -bash-3.2# installer -pkg /Volumes/usb-osx/Packages/OSInstall.mpkg -target /Volumes/macHD installer: Package name is OS X installer: Installing at base path /Volumes/macHD 2013-10-13 21:36:12.016 installer[411:817f] Looking for system packages 2013-10-13 21:36:12.092 installer[411:817f] no system packages found 2013-10-13 21:36:12.093 installer[411:817f] No or Invalid system receipts found on /Volumes/macHD/Recovered Items 2013-10-13 21:36:12.093 installer[411:817f] Attempting fallback using: /System/Library/PrivateFrameworks/SystemMigration.framework/Resources/FallbackSystemFiles.plist 2013-10-13 21:36:12.423 installer[411:817f] Finding system files... 2013-10-13 21:36:13.907 installer[411:817f] Writing system path cache. 2013-10-13 21:36:13.941 installer[411:817f] FSF cache NOT written: /Volumes/macHD/Recovered Items/System/Library/Caches/com.apple.FindSystemFiles.plist No mount point for /Volumes/Image Volume/.IABootFiles Cant determine mount point of /Volumes/Image Volume/.IABootFiles Could not statfs() Could not determine filesystem of installer: The install was successful. 


Unfortunately, the installation process is not informative (no progress is visible), you can indirectly observe the change of free space on the macHD section in the adjacent terminal tab.
 -bash-3.2# df -h | grep macHD /dev/disk0s2 232Gi 3.4Gi 229Gi 2% 881294 59958448 1% /Volumes/macHD ... /dev/disk0s2 232Gi 3.5Gi 229Gi 2% 911436 59928306 1% /Volumes/macHD 


The installation takes about 1 hour, after completion it takes 7.3Gi on disk.

After the end - we reboot.
 -bash-3.2# reboot 

After a reboot, we are greeted by a freshly installed OSX.


Bonus


Having a little experimented, I found an interesting side effect - in this way, you can make a downgrade of the operating system, replacing the contents of the Packages catalog with earlier versions (10.7, 10.8)

Instead of conclusion


I hope the article was useful, comments and obscene language are accepted. For myself, I received a pleasant confirmation that under the "ryushechkami" nice GUI OSX, hides the most powerful command line. You just need to know how to cook it.

Source: https://habr.com/ru/post/197204/


All Articles