Senin, 03 Desember 2018

How-To Fix Corrupt User Accounts in macOS

Sometimes our Macs behave in strange ways. We think of and use our Apple Computers as if they’re stable and perfect until they fail. Then all hell breaks loose. What can we do to get that machine back to its beautiful normal?


Recently, I’ve had some major problems with my Mac. Even though I can log in, none of my applications will launch. On top of that, the computer is sluggish and not useable. At times, I get the spinning beach ball for what seems like forever.  Do you relate? Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


When trouble strikes, it’s often your user account settings causing the problems.  In my case, it turns out that my issues are indeed related to my user account. It somehow got corrupted.  And no, I didn’t DO anything—really, I didn’t.


These times of crisis are reality checks. Nothing, even Apple Products are perfect all the time.


So, if something happens, don’t panic. There are a few things we can do to fix the problem. Try them out and let us know if something works or if you have other ideas. Help is ALWAYS welcome here at Apple ToolBox.


So let’s get to it!



Related Articles



A Word About User Accounts


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


Think of your Mac user account as your information’s heart, the place your data always returns to. Your user account’s HOME FOLDER stores most of your everything, including the changes you make to application settings and it also a slew of other things:



  • Files on the desktop

  • Your desktop picture preference

  • Safari caches, history, and website data

  • Your email, contacts, and calendar appointments

  • iTunes music and videos, and pictures from Photos, Photo Booth, and other apps

  • Custom settings created for apps like Mail, Safari, Messages, Facetime, Notes, Contacts, Calendar, Finder, as well as third-party app settings

  • Files in the Documents, Downloads, Movies, Music, Pictures, Public and Sites folders located in your Home folder


Changed the permissions of items in your home folder?



Sometimes, when you change the read or write permissions of items within your home folder, you also need to reset its permissions.


This situation is especially true if you use the keystroke Command+I (or any other method to Get Info) to change those permissions.


If you experience any of the symptoms below, you might have a problem due to changes in your home folder’s permissions


Reported Symptoms include:





  • When trying to save changes, you see a message that the file is locked or that you don’t have permission to save

  • You frequently (and repeatedly) see the message that macOS needs to repair your Library to run applications

  • In the Photos App, you see a message that your library needs to be updated or reselected each time you open Photos

  • System Preferences changes aren’t saved after you quit System Preferences

  • A message pops-up that the startup disk has no more space available for application memory

  • Updating your Dock isn’t saved after you log out of your user account

  • Windows that were open the last time you logged out or quit an app (before you changed permissions) open again after you log in or open the app

  • When moving items in the home folder, your Mac asks for an administrator name and password word

  • Preview, TextEdit, and similar apps unexpectedly quit when you try to open them

  • Activity Monitor shows that Safari or SafariDAVClient is using a lot of system resources

  • You’ve noticed a marked decrease in your Mac’s performance

  • iTunes displays a message that your device cannot be synced

  • Photos (or videos) that you import into Photos app don’t appear within the app but do appear in Finder


If you see any of these errors, resetting your home folder permissions often solves the problem.  Readers report this works for all macOS versions (including Mojave & High Sierra/Sierra) and most Mac OS X versions.


Just remember to RESET YOUR HOME FOLDER PERMISSIONS.



Be Prepared With Another Administrator Account


Okay, this is something I should have done but didn’t. Lesson learned. So for all you who are superb iFolks, this is for you.


Before anything happens, create another account with administrator access. Be prepared with another way to get into your Mac that doesn’t involve reformatting the hard drive and losing everything.


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


With that other admin account, you reset passwords, delete accounts, and troubleshoot. So you fix problems without having to take drastic actions, like wiping your drive clean.


If your issue(s) doesn’t happen in a different user account, then it’s likely that both macOS and your installed apps are working correctly.


So when you are logged in to your usual user account applications exhibit unexpected behavior(s) such as it doesn’t start, it executes commands incorrectly, it returns errors, or it quits unexpectedly.


BUT, when you log into a different user account, you see that these issues don’t occur.


The verdict: The issue(s) is consequently related to your specific user settings or files.  So it’s time to do some trial and error to figure out what’s going on with your user account.


Permission to Reset


Maybe all we need is to repair some user file permission (fingers crossed), so let’s try fixing that first. We’ll need to restart in Recovery Mode


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


For Yosemite and below



  1. Shut down your computer

  2. Press Command+R Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS

  3. Press the power button

  4. Hold Command+R until you hear the startup chime or see apple logo and progress bar

  5. Select Disk Utility

  6. Select Disk Verify Permissions

  7. After verify, choose Repair Disk Permission


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


 


Starting with El Capitan, Apple removed from Disk Utility verify and repair permissions buttons.


Apple claims that all system file permissions are now automatically protected and updated during software updating. But of course, there’s always a means to an end.


For El Capitan



  1. Shut down your computer

  2. Press Command+R

  3. Press the power button

  4. Hold Command+R until you hear the startup chime or see apple logo and progress bar

  5. Select Utilities Menu at the top of the screen

  6. Select Terminal Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS

  7. In the terminal window, type resetpassword

  8. Press Return  Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS

  9. A Reset Password window opens

    1.  WE ARE NOT GOING TO RESET THE PASSWORD



  10. Select your startup disk (Macintosh HD if not renamed)

  11. Select your user account

  12. Under Reset Home Directory Permissions and ACLs, click Reset

  13. Select Restart from the menu bar


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


 


For macOS Sierra, High Sierra, and Mojave


Unfortunately, the workaround to repair disk permissions and ACLs no longer works in macOS Sierra.


According to Apple, manual disk permission repair isn’t necessary anymore. macOS Mojave, High Sierra, and Sierra (and Mac OS X El Capitan) repair file permissions automatically during software updates.


Improved file integrity starting with El Capitan and expanded in macOS Sierra, apparently makes manual disk permissions obsolete.


If you believe your user account problems do indeed stem from disk permission problems, the best option currently available for macOS Mojave, High Sierra, or Sierra is to update your OS if an upgrade is available.


If no update is available, try the tips listed below.


Reset Home Folder Permissions


If the issue started after changing the permissions of items in your home folder, reset permissions: Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS



  1. From the Finder menu bar, tap Go > Home (or Shift+Command+H)

  2. Choose File > Get Info (or Command + I)

  3. Open the Sharing & Permissions area (click the triangle next to it if you don’t see any information)

  4. Check that your home folder permissions are unlocked (look at bottom right for lock icon)

    1. If you see a closed lock, tap the lock once and enter an administrator name and password to unlock



  5. Once unlocked, select the Action menu at the bottom left corner of the window and choose to Apply to enclosed items

    1. Select OK to confirm that action

    2. You’ll see a progress bar at the top of the window as the action completes



  6. Once the progress bar finishes, open Terminal from Utilities folder of your Applications folder (or press CMD + Space to open spotlight search, and type Terminal and hit return)

  7. Paste or type this command in Terminal, then press Return: diskutil resetUserPermissions / `id -u`

    1. For US keyboards, the ` character is just above the Tab key

    2. After entering the diskutil command, if Terminal says that permissions reset on user home directory failed (error -69841), enter chflags -R nouchg , then enter the diskutil command again:  diskutil resetUserPermissions / `id -u`



  8. Once done, quit Terminal


For MacOS, this is the terminal command that repairs user permissions as outlined in these Apple Support Notes on how-to resolve issues caused by changing the permissions of items in your home folder.


Terminal Commands Not Working in macOS Mojave? Seeing Operation Not Permitted?


If Terminal is not accepting your commands when working with macOS Mojave, you likely need to give Terminal Full Disk Access.


Grant Terminal Full Disk Access


Open System Preferences > Security & Privacy > Privacy Tab



  1. Select Full Disk Access from the left sidebar

    1. If you can’t make changes, unlock your disk and enter your admin password if needed



  2. Tap the + symbol

  3. Add Terminal to your approved apps with Full Access Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS

  4. Restart Terminal and see if it now accepts your commands


Tap More Into Terminal


If you feel comfortable, try using a command line in Terminal.  Some readers report this works for them–particularly for folks still running Mac OS X.


Open a Terminal Window



  1. At the command prompt, enter this exactly including spaces

    1. sudo /usr/libexec/repair_packages –repair –standard-pkgs /



  2. At prompt enter your admin password

    1. Wait a minute or two



  3. If there are any errors, they display and your system repairs them, if possible

  4. If there are no errors, it displays nothing


Boot to the Recovery Partition



  • Press and hold Command+R until you see the Apple logo

    • If your Mac doesn’t boot, hold down the Option Key while booting to display the built-in Startup Manager and choose Recovery Partition

    • Or manually start up from macOS Recovery over the Internet, hold down Option-Command-R or Shift-Option-Command-R at startup



  • Open Terminal and type repairhomepermissions

    • For macOS, try diskutil resetUserPermissions / `id -u`




This command opens up a window similar to reset the permissions on user accounts.


Boot Up Safe Mode


If you don’t have a spare admin account, let’s try rebooting your Mac in Safe Mode. We’ll then remove some of your cache files that may be the source of the problem.


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


To boot in safe mode, shut down your computer



  1. Press the power button

  2. After hearing the startup tone, press and hold the Shift key

  3. Release when you see the gray Apple icon and the progress bar

  4. Once Safe mode is loaded, open a Finder window

  5. Press Cmd-Shift-G.

  6. Type in /Library/Caches to go to the caches folder


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


Totally removing the cache is not recommended so save a backup of all the cache files before deleting them. If something happens, you can restore the old files using the backup.


Create a folder in Shared and place the Cache backup there



  1. Once you get a backup, go ahead and delete the Cache

  2. Restart the computer

  3. Now check and see if this solved the problems with your user account. If not, continue to next steps


Hide and Seek: Finding the Bad Preference File


This one is deadly boring and time-consuming, but it’s still a better option than having a non-working computer. A corrupt preference file(s) is often the cause for unusual behavior on your Mac, especially if an application isn’t opening or crashes frequently. Preference files store all sorts of application-specific information, everything from your browser’s home page to font settings, and even things like the shortcuts you keep in your Finder sidebar. Let’s first boot up in safe mode. Remember in this case patience really is your biggest ally (and virtue.)


Reboot into Safe Mode



  1. Open a Finder window and press Cmd-Shift-G

  2. Type in /Library/Preferences


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


Move those preference files one by one somewhere else, preferably in a folder marked OLD Preferences. Restart your computer each time and see if the user account is fixed. Yes, I did warn you about the deadly part of this solution.


There’s An App for That!


Yes, of course, there is an app for almost everything including repairing permissions. InsanelyMac offers a RepairPermission app and a Disk Utility app that do the work for you. Kext Utility for Mac provides similar services, including repairing permissions for all system folders and rebuilding system caches.


However, you need to boot with SIP (System Integrity Protection) disabled or a permissive CSR config.  So to run, you must Allow apps from Anywhere under System Preferences -> Security & Privacy. To enable these options to execute in Terminal: sudo spctl –master-disable


System Integrity Protection (SIP) was introduced in El Capitan and is called a rootless mode. It provides more security to your Mac and prevents malware from modifying system files and directories.


To Disable Your Mac’s SIP (System Integrity Protection)



  1. Restart your Mac

  2. Boot into Recovery Partition

    1. Hold down Command-R until you see an Apple icon and  progress bar



  3. From the Utilities menu, select Terminal

  4. At the command prompt type exactly this csrutil disable 

  5. Press Return

  6. The terminal displays a message that SIP is disabled

  7. Restart from the Apple menu (upper-left)


Re-enable SIP using the same steps including restarts and typing exactly this csrutil enable


A Visit With AppleCare


If your computer is still under your AppleCare agreement, the time has come to call or take the computer to the Apple Stores. Let the Geniuses take a look at it; you paid for this after all!


They usually know what they’re doing and should fix the problem in a lot less time than you. They certainly see a lot more questions than we do (thankfully.)


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


 


Even if your Mac is out of warranty, you may still be able to get it fixed for less than you think. Try this first, before paying:


If you paid with a credit card, then the card company may cover it. Check your credit card rules to see if you qualify for protection.


The Point of No Return


For your worst-case scenario, we hold no stops. We will use the Recovery Partition. Just make sure you connect to the Internet via WiFi or Ethernet cable.


Use Your Mac’s Recovery Mode To Reinstall macOS or OS X



  1. Restart your computer and hold Cmd-R as it boots

  2. Select reinstall macOS or OS X and follow the instructions.


Sometimes our Macs behave in strange ways How-To Fix Corrupt User Accounts in macOS


Summary


Lesson Learned—always have a backup plan. So be prepared by having at least 2, yes TWO, admin accounts on your computer. And as Apple ToolBox recommends regularly back up your files preferably following the 2X2 rule (two clouds, two locals.)