[Solved] How Do I Fix “macOS needs to repair your Library to run applications” Error on High Sierra?

Problem: User no longer has permissions to access home folder and error message “macOS needs to repair your library to run applications” show after upgrade to High Sierra, password doesn’t work to complete that process.

Error

Content Summary

Solution 1: Execute Disk Utility First Aid
Solution 2: Reset permissions
Solution 3: Changes user and/or group Ownership of each file in Library
Solution 4: Reset Password Command
Reference

Solution 1: Execute Disk Utility First Aid

Step 1: Go to Utilities > Disk Utility > First Aid tab.

Step 2: Select Run on the appeared pop-up dialog box.

Step 3: Restart computer.

Solution 2: Reset permissions

Step 1: From Finder menu bar, select Go > Home to open your home folder.

Step 2: Choose File > Get Info to open Info window of your home folder.

Step 3: Click the triangle shape to open Sharing & Permissions section.

Step 4: Click the lock and enter an administrator name and password if the Lock button at the bottom of the window shows as closed.

Step 5: Click the Action menu in the bottom corner of the window and choose Apply to enclosed items.

Apply to enclosed items.

Step 6: Click OK to confirm the action.

Step 7: Open Terminal app then enter below command:
chflags -R nouchg ~
diskutil resetUserPermissions / `id -u`

Step 8: Quit Terminal and restart computer.

Solution 3: Changes user and/or group Ownership of each file in Library

Step 1: Login to the affected profile.

Step 2: Open Terminal app.

Step 3: Enter below command to get the new user ID:
id -u

Step 4: Enter below command to get the new group ID:
id -g

Step 5: Enter below command to change ownership:
sudo chown -R userid:groupid /Users/
sudo chown -R userid:groupid ~/Library
sudo chown -R ~/Library
sudo chgrp -R ~/Library

Step 6: Reboot computer.

Solution 4: Reset Password Command

Step 1: Boot your mac into Recovery mode by pressing CMD + R key.

Step 2: Go to Utilities menu > Terminal to open Terminal app.

Step 3: Type resetpassword command.

Step 4: Select Systemdrive.

Step 5: Select Username from the list.

Step 6: Click on Reset Home folder Permissions and ACL’s button.

Step 7: Reboot your Mac.

Note: Sometimes will need to run resetpassword for second time until it works.

Reference

Apple Support: Resolve issues caused by changing the permissions of items in your home folder
Apple Discussion Communities: macOS needs to repair your Library to run applications. Type your password to allow this.
chown(1) – Linux man page
chgrp(1) – Linux man page