Recover from OSX Catastrophe

Notes to Myself, Because (Unlike MacOS) OSX Is User-Hostile

See also I Hate Win10, because Win10 is even more User-Hostile than OSX.

OSX is unix, and as everybody knows, eunuchs are missing a vital organ so they cannot perform. The system is aptly named.

Safari full-screen: Command-control-F is supposed to toggle, otherwise mouse to the top and the menubar might appear; the green button at the top left should toggle it. Escape key usually doesn't work.

The latest Finder is like the children's story Epaminondas, where the kid "ain't got the sense you was born with." The MacOS Finder remembers every folder, where you put it, and what its view options are, just like you want it. OSX was "born with" most of that sense, but done forgot it all somewhen before the latest release, so folders (if they open in a new window at all, which no longer can happen without extra effort every time) open to the whatever window position and view options you last chose for a completely different folder, like Epaminondas in the story carrying home each different food item using the instructions for the previous, thereby destroying everything.

The most common unix failure mode is to go catatonic, with no obvious way out. When all else fails, force-reboot (power-down 5s, then back up). If that fails, option-reboot into a backup partition.

OSX corrupts (continuously writes all over) every drive you mount -- unless it has a file named ".metadata_never_index" in the root directory, but the only way to get it there is in some other OS. This means OSX-format volumes are not safe when mounted in OSX. One of the hazards of using an inferior OS.


You need a bootable backup: create a partition no smaller than your source (unlike MacOS, it can't remove unused space), then somewhere else, use DiskUtility to make a disk image (Read-Only or Compressed both work, but Read-Write fails) of the boot (or some other) volume, then prep the image for restore (Image menu), then restore it to the new partition, which should then show up on opt-boot. This does not seem to work for older OSX systems (like the PPC systems that still run 68K code in emulation), so you are out of luck unless you have a later system you can do part of the work on (see "Backing Up OSX.4" below). Hey, it's eunuchs.
TechRepublic offers a procedure for building multi-partition boot disks from Apple install media, but says nothing about the partition choice -- I saw (somewhere, but cannot find it again) that x86 hardware boots from "GUI" partitions, while PPC hardware boots from "Apple" partitioning schemes. I am unable to confirm or deny that, because nothing works for me.

Mac-Forums says to use 10.7 or later to format ("make bootable") before installing. Several links at the bottom, one seems to imply you can do this right in 10.4 Tiger (and does mention "Apple Partition Map"). This page clearly explains "Check in Disk Utility that the drive is Apple Partition Map and not GUID. If it isn't APM, it won't boot on a PPC Mac."

WiredAtom says "Assuming you have a bootable Firewire drive (not all firmwares are created equal)..."

SuperDuper offers a tool to do it, dunno if it works...

The last partition of a drive can be shrunk if it's not the boot volume (mount it in Target mode to do that before making an image). It takes a while to de-frag if needed. Err on the high side: I asked for 30G and got 17G; but after shrinking, it's no longer top partition and cannot be further resized (either direction). Did anybody ever say OSX was user-friendly?

If you boot a Mac while holding down the "T" key until you see a Firewire icon displayed on screen, this signifies that target disk mode is detected and working (it can be a disk drive for another Mac).

MacOS emulation: -- it should be spelled "emasculation" because (like OSX) it cannot perform, so don't waste your time on it.


Getting rid of the Dock involves making changes in /System/Library/CoreServices/, which my system integrator "Z" told me would make other things fail, so I need to have an alternate boot handy before I do that. But a pretty good first approximation is a single command line in the Terminal window:
defaults write tilesize -int 1; killall Dock
The popup is now pretty small with no visible icons. Conceivably it could be made even smaller by substituting "-float 0.1" for "-int 1" but I was unable to see any difference. If you move the mouse over the diminuative tab, full-size names still pop up, but the tiny hot zone is much harder to hit by accident than the obnoxious old full-sized Dock. An older version of OSX gets confused by tilesize =1 (piles up huge icons in the top left corner), but 2 works.

After I successfully made a bootable backup of the system, I moved (made a copy) of to a different folder -- unlike MacOS, all unix pathnames are hard-coded, so if you move or rename a system file, it's the same as deleting it. OSX won't let me move or rename the Dock, but it did let me put it in the trash and empty the trash (while running from the backup drive). When I rebooted the altered system, the Dock is gone! Programs switch back and forth just fine by clicking on their windows the way it always worked in the Mac, but I could not click on any icons on the desktop. I mean, I could click there but nothing happened. I'm going to need to get used to using DiskUtility to eject what I used to do by dragging it into the trash -- oh wait, there's no trash icon in the corner of the desktop anyway, in OSX the only way to get rid of volumes is to right-click and choose "Eject" from the popup menu. Right-click also doesn't work on Desktop icons. Also command-tab no longer pops up an ugly gray smudge in the middle of the screen, another benefit.

I wondered how to open a Finder window if I ever managed to close everything, but the Finder has a "Go" menu that lists a few (mostly worthless) things they thought important, and choosing a hard drive from that menu gets things back.

Now if only I could get rid of the Finder popups.

What I hate most about OSX is command lines, but some things are unavoidable. In the Mac ResEdit does nearly everything that needs doing (no stinkin command lines here!) so if you want to see otherwise invisible files (like to delete them), get their info in ResEdit and uncheck "Invisible." In OSX it requires a command line:

defaults write AppleShowAllFiles YES

Now if only I knew how to find (and delete) whatever Spotlight needs to corrupt everything... Oh wait, with hidden files visible, I can add a ".metadata_never_index" file to each volume, and drag the Spotlight folder into the trash. It seems to work, and got rid of more than 2GB of unwanted "index" on my hard drive.


Backing Up OSX.4 (Tiger)

The short version is: You can't.

The reason I want to do this is that OSX.4 is the last version of OSX that ran "Classic" compatibility mode, and all my software tools over the last 30+ years are in 68K native code running in MacOS (not OSX). I tried to migrate my stuff to OSX when it first came out, but OSX is buggier than a downtown walkup, so I failed. OSX never got better, so I stayed with the Mac. I do not regret that decision. Then this G5 tower arrived with the encouragement to "run faster" (at 4x the native clock rate of the Mac system I've been using since 2004), but it would be foolish to put anything valuable on a system that cannot be backed up on an external drive. OSX more than compensates for the higher clock rate by cognitive slow-downs, so the result is still far slower than the (real) Mac I have been using for 13+years -- except for long compute-bound tasks. Maybe some day I will get around to writing a Finder replacement. And/or an x86 code generator for my compiler, so OSX.4 (or even OSX at all :-) is no longer needed.

People who cannot produce new intellectual property (IP) and have only poor-quality IP under their control, they tend to be the most paranoid about protecting the very little they have. OSX is flakey and unstable and crashes a lot -- perhaps less now than back in 2007 -- but still even now much less stable than the MacOS was, so the lawyers controlling their IP are very tight about making copies, and even more so in 2007. Like the Jihadists, I think it's a matter of shame: they are so ashamed of what they are doing that they don't want anybody to see it/them. The result is that DiskUtility fails ("input/output error") when attempting to make an image copy of the system boot drive in OSX.4. But I am a professional: if there's a back door way to do things, by God's grace I can find it.

Using "Target" mode, I tried to do the backup from the latest OSX running on a separate computer. It said it succeeded, but the volume was not visible at boot time. I asked for and got the OSX install DVD, which made the volume visible at boot time, and it actually did start to boot up, but then it hung (from the user perspective, it "crashed").

So I retried restoring the image that OSX.11 made of the system. It crashed OSX.11 (no big surprise).

Today (17Mar.27) I tried restoring the image OSX.11 made, but within OSX.4. It worked. It takes two computers, one of them running OSX.11. It might work if you already have a second bootable hard drive, but I doubt it, because it failed from the install DVD. Maybe when I have another day to waste, I might try it from the copy I just made today.

So here's how to navigate the labyrinth:

1. Use the install DVD to install OSX.4 on the destination volume. It makes you agree not to use it for anything valuable, which is OK, you aren't going to use it at all, you are only running the installer to make the volume bootable. If it's already bootable, you can skip this 3-hour step.

2. Switch to Target mode and mount the volume with the system you want to back up on OSX.11, then create an image of it, on some other volume. I collect all my backup images on a single volume, which is also backed up. If you delete the temporary files before backing up, the backup images are much smaller than the volume you are backing up needs to be.

3. Reboot OSX.4 and run DiskUtility to "Scan for Restore" the new image, and then to restore it onto the destination volume. Be sure to tell it to erase the previous contents so as not to violate what you agreed to for the installer DVD.

The whole process takes all day, some 3 hours each to install the worthless new OSX.4 and to create an image of the system you want to back up, and then two hours to scan the image. The actual restore is pretty fast, maybe 10-20 minutes.



Rapid fade to black during or shortly after boot: on they suggest repeatedly:
1.Shut down the Mac and connect it to your MagSafe adapter and a wall outlet as usual
2.Hold down the Shift+Control+Option+Power button at the same time for a few seconds
3.Release all keys at the same time, then boot the Mac as usual

When that doesn't work:

1.Press the Power / OFF button once -- this will bring up the dialog box which you can't see
2.Press the "S" button -- this is the shortcut to sleep the Mac
3.Hold down the Power button until a hard shut down is forced
4.Wait about 15 seconds, then hit the Power button again to turn it back on

Then try:

1.Reboot the Mac and as soon as you hear the boot chime, hold down the Cmd+Opt+P+R keys together
2.When you hear the boot sound again, the PRAM has been reset so let the Mac boot again as usual

None of that worked for me, but one of the many commenters suggested turning off the "Use all F1, F2, etc. keys as standard function keys" control panel option which should make the brightness keys work, so I tried pounding on the brightness key (F2) both with and without the "fn" key pressed, and that brought up something to look at for a few seconds, and after a few tries, managed to get the Energy Control Panel (lightbulb) open and pressed the Battery button and drag the sleep slider to the right, and it stopped going black. The same system backup that failed on this computer boots fine on another MacBookPro which I had to replace the battery a couple months ago because it wouldn't boot at all, so I suspected the battery was dead or dying, and the OSX system has a bug that won't let it run on wall power (OSX doesn't seem smart enough to see that it's plugged in and 99% (or even 100%, according to the menu icon) charged. My solution was to keep banging on the brightness (F2, with and/or w/o fn) until I got to energy saver control panel and turned the time to sleep up to 1 hour or more on battery. It seemed to work, so I resolved to Buy a new battery. However, read on...

Another commenter said that it was overheating, but it still failed for me after being off three days. Another commenter said:

Had to get a torch to shine it at the screen though to get through the secure login! What is previously black becomes just about visible. Can't see the curser so use tab to move from line to line in security.

But I already had it working by then. After I realized it could be sleeping (and the sleep throb was pulsating), I tried closing then opening the clamshell and that gave me a few more seconds to bring up the energy c/p.

Another commentator called Apple and was told:

COMMAND S on startup to get into a safe directory mode. Then he had me type the following hitting ENTER after each line. Note the line with ".old" at the end. In the box I typed in it became two lines« -- I don't know how it will show when posted. It is ONE line with a space between loginwindow.plist and
mount -uw /
cd /Library/Preferences

This worked for me and got me to the login page. The tech said the code just sets your computer to find the last working startup.

What I hate most about OSX is command lines, so I didn't try it. Another commentator added, "I had a black screen and could see pointer, but that was it." That was not true in my case, there was nothing at all. I don't think I had a software problem that could be solved by deleting or renaming a file, because my bootable backup (on an external drive) had the same problem, and the same bootable backup didn't fail on the other computer.

Another commentator said:

After attempting ALL of the suggested fixes multiple time I finally called tech support. Ellen had me hit the power button and then hit the shift key which started the computer in Safe Mode. It brought up the login dialog box and once I entered my password the computer brought up my regular startup screen. I clicked on the apple in the top left corner of the screen and then hit restart. It brought up the login screen again and once I logged in everything was back to normal -- running real slow after loading Yosemite.

Another commentator said:

MAGNETS!! Now I know my circumstances are very rare. I'm the family "IT Fixit guy«" and so I had 2 Macbooks at the same time. I had stacked the one I was fixing on top of the other one (with the lid closed). What I didn't realised was that the magnets in the bottom MacBook were confusing the top MacBook. So the top MacBook thought the screen was closed (and so, turned it off). Lift the top MacBook off the bottom one and the problem goes away.
That could be my problem: I moved the top Mac several inches over with some padding between them, restored defaults to the energy c/p and now it works fine. It went dark after a minute or so, but woke right up when I jiggled the mouse. Magnets around computers are A Bad Idea. Magnets inside the computers are still A Bad Idea.

I stopped reading comments after the first 100, most were so happy that zapping the parameter RAM worked.

2017 March 27 *