Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have just removed Macports. After that I did some random checks in directories and found out that some files still have Macports as their owner. So I did a 'find' on all files that have Macports as their owner and I was shocked by the results. Tons of images, Spotify files, crashlogs that had absolutely nothing to do with Macports are apparently owned by Macports (while Macports has been removed according to their own uninstall instructions).

Now I am in no means a good administrator but when I remove something it would be nice if everything will be reverted to its former state. Plus on top of that I don't even know why Macports would take ownership of all those files.


  1. Can anyone explain to me how this could have happened and what I can do to prevent it from happening again should I want to use Macports again.
  2. How can I safely reclaim ownership? The problem is that I don't even know "who" used to be the owner of the files at hand.
share|improve this question

2 Answers 2

up vote 0 down vote accepted

If the files should be owned by you, you could do something like this:

sudo find ~ -user macports -exec chown $USER {} +

I have also uninstalled MacPorts and I still had a user named macports, but there were no files owned by it.

share|improve this answer
Thanks for your answer Lauri, could you please explain to me what the {} + part does exactly? – user238311 Jul 16 '13 at 15:44
See man find. {} is a placeholder for arguments, and + tells -exec to take multiple arguments at a time. – ؘؘؘؘ Jul 17 '13 at 8:55

I can verify that a similar phenomenon has occurred on my Mac: I have MacPorts 2.3.3 installed (on OS X 10.9.5), and user macports recently took ownership of many seemingly random files on an external drive that I use regularly, including media files and applications.

I noticed the problem because suddenly today I could not download from Firefox to my designated downloads folder, which is on the external drive; after examining the downloads folder, I noticed that the user and group of the folder had been changed to macports, and was read-only for other users. After some searching, I discovered that user macports had commandeered a number of other files on the external drive unrelated to MacPorts.

The previous answer worked for me, e.g.:

sudo find /Volumes/External -user macports -exec chown $USER {} +

However, that only changes the user, and I needed to change the group too, e.g.:

sudo find /Volumes/External -group macports -exec chown :staff {} +

MacPorts ticket #41039 discusses a similar issue and may shed some light on the origins of the problem:

Update: I have determined that the probable cause of the problem, in my case, is that I occasionally connect my external drive to other Macs, and on one of those Macs (let's call it Computer B) the user account that I use has uid=502 (MacPorts is not installed on Computer B). User macports on the other computer (let's call it Computer A, on which MacPorts is installed) also has uid=502. So after I have used the external drive on Computer B, later when I mount the external drive on Computer A, any files that I created or modified on Computer B will have user and group macports on Computer A.

So, for example, any files that were created on another computer with uid=502 and then are copied to a computer that has MacPorts installed (where user macports has uid=502) will be owned by user macports on that computer. Or, if you once had a user account on your computer with uid=502, but then you delete that account and later install MacPorts, and then user macports uses uid=502, all of the remaining files that were once owned by the deleted user account will now be owned by user macports.

share|improve this answer
You should really get straight to business when writing answers. The first two paragraphs would be acceptable in a question (to provide context), but in an answer they just distract and confuse the readers. – Dmitry Grigoryev Oct 26 at 14:16
Thanks @DmitryGrigoryev. In the future I will try to be more concise. In this case, parts (though perhaps not all) of the first two paragraphs are necessary to explain the origins of the problem, which is closely connected to the fact that I was using an external drive. I added more information to my answer to explain the connection between the external drive and the origins of the problem. (The original question requested not only a solution to the problem but also an explanation of the probable cause of the problem, which I have now tried to provide to the best of my ability.) – Big Mac Oct 26 at 14:53
An answer is supposed to solve the original problem, not a similar one that you're having (don't take this as a rant, I'm just trying to explain how things work on Q&A site). Your problem is very close to the original one, so your answer is perfectly relevant (and upvoted), but it's easy to get carried away and see your answer removed because it looked like a follow-up. – Dmitry Grigoryev Oct 26 at 15:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.