Chosen Solution
My 2012 13” MacBook Air 1.8 GHz (5,2), running MacOS Mojave10.14.3 is hanging frequently. It starts with a beach ball after which all processes come to a stand still. Left to itself the system goes into sleep mode. The same thing happens if the lid is closed. When reopened it tries to boot but fails after about 60% of progress. Left to itself, the screen goes white. After sometime there appears a folder with a question mark as if it is not able to locate the boot disk. But it boot as expected after a forced switching off. It shows a kernel panic something like “failed after 5 attempts - quitting” on the previous boot. This problem started following some adware attack. First it was Mackeeper which I tried to remove following all discussions on the topic killing all related files in appearing in Launch Agent, Launch Daemon in the ~\Library folder. I also used the “deleteMackeeper.sh” file suggested elsewhere. The problem persists. An Etrecheck showed a couple of problems with adware which were deleted but no improvement. I must add that my battery is failing (runs at 65 %). Whenever the beach balling occurs, a file is created in the ~/Library folder with name “ApplicationSupport”. It has inside it only one file “ApplicationContents”. The ~/Library folder contains two files “Application Support” and “ApplicationSupport” (without any space between the words). There are also two files “Assistant” and “Assistants”. The file “Assistants” contains nothing and can’t be deleted. After every reboot I delete the “ApplicationSupport” file and it seems to help for some time. But the file is regenerated after every beach balling. A First-Aid run in Disk Utility showed no problem and same is the case with an extended apple diagnostic check. Last night from a suggestion in MacRumors did scan with Malwarebytes and 9 issues were detected and cleaned. But the problem persists … Any suggestion will be highly appreciated. Thanks.
You’ll need to first backup your created data and setup a bootable OS installer USB thumb drive. Here’s how How to create a bootable macOS Mojave installer drive. Using it to boot up you need to completely wipe your drive! using the erase function, then reformat the drive and install a fresh copy of your OS. You don’t want to restore any apps! You want to re-download them from the Apps store or original source
You can create a brand new user from system preferences, remember to choose “administrator” as the system by default creates a standard one. If beach balling continues with the new user then you likely have a hardware issue, check condition of your boot disk with disk utility and check battery status with Coconut battery. With these preliminary test we might be able to get at least some indications on where to look forward.
In light of all the things you’ve tried, it sounds like your Hard Drive cable needs replacing. The 2012 13” Macbook Pro a1278 (Non-Retina) is notorious for it’s failing cables. MacBook Pro 13" Unibody (Mid 2012) Hard Drive Cable I’ve attached a link to said replacement cable. :)