Mac needs to repair library after changing location of home directory I recently reinstalled Yosemite to fix the notorious WiFi bug, and i have two hard drives, one SSD which i reserve for apps and boot, and the other HDD for data (including user data).

I started up my mac made a user account on the SSD (aside from my original one, this is a safety precaution in case the HDD goes down and i need to log in to an account on the SSD), then i copied my user folder to the HDD and went to the advanced settings for that account and pointed it to the new location on the HDD.

When i logged into my account that now has a home folder on the HDD a screen pops up saying OS X needs to repair your Library to run applications. Type your password to allow this

I type my password but it just pops up again in an infinite loop.

One strange thing to note is four ? symbols on the dock for keynote, pages, and other apps that i haven't had installed (And haven't even purchased). 

Why would simply copying the fresh user folder from my SSD to my HDD (both were formatted during install) cause this error?

When i force restart and log into the admin account on the SSD i can point my user folder back to its original folder on my SSD (since i did not delete it) and then log into it and everything is normal (and there are no ? symbols for apps i don't own on my dock either.
NOTE: I got this same error after upgrading from El Capitan (10.11) to Sierra (10.12), so hopefully this will work for your issue.

Steps I took to resolve this:


Open Terminal and copy the following: "defaults write com.apple.Finder AppleShowAllFiles YES" (do not sudo) and hit return. Then type "killall Finder" and hit return.
Using Finder, select Go > Computer > Macintosh HD > Users > User Folder > User Library. Right click and select Get Info > Permissions
In info Library window, unlock to make changes and ensure there are no other users except User and Everyone. Toggle “Read &amp; Write” to “Read” and back to “Read &amp; Write”. Select the gear icon to apply to enclosed items.
Close all credential prompt dialogs by hitting Cancel until the prompts stop. Reboot your system and the issue should be resolved.