If going from 501 to 502 is bad, would the opposite approach work? Can I keep my current user ID, change it from 502 to 501 somehow,
Should be possible. The command calderone posted looks right, except it need to be prefixed with
sudo (unless the terminal is running a root shell). There is also a GUI method available via
System Preferences --> Accounts Advanced Options you could consider using.
and then run that command to change ownership of all files/folders from 502 to 501?
Well sort of. The command i posted focused exclusively on the /Applications folder. Not having done a uid conversion myself (using either
dscl or the 'Advanced Options' GUI method, i'm not sure what all extra steps may be needed (as opposed to what all does Directory Services change on its own when done using either of those techniques).
Most likely, your home folder will need the 502 -> 501 reversion. [again, i would think going through System Preferences --> Accounts (Advanced Options) would handle that part for us... but i've never tried it.]
But if we need do it ourselves, then the command i previously posted would need to target something besides just the /Applications folder (as well as reversing the 501/502 order):
sudo find -x ~ -user 502 -exec chown -hv 501 {} +
There i changed the order and substituted /Applications with ~ [where the tilde (with no user specified after it) is a shortcut meaning /Users/you]
Alternatively (instead of targeting one folder here and one folder there) the entire HD could be processed as a whole with:
sudo find -x / -user 502 -exec chown -hv 501 {} +
...where the slash means searching the entire HD [and the -x prevents wandering inside other mounted volumes or shares]
I just hope your uid actually is 501 before you run any of those. That condition can be verified, by looking at
id (as above) or with:
dscl . -read ~ RecordName UniqueID
[no sudo needed there, for just reading]
EDIT: Oh wow... that's what happens when i spend too much time on a post.
Okay, i didn't see your 5:09 PM message until just now. It seems pretty strange that the
dscl command worked for you
without sudo... but other than that, good job.