28

My 2012 MacBook Air (11", i7 2GHz 8GB RAM) crashed and I had to erase the SSD and re-install macOS High Sierra with the Internet Recovery Mode tools. Once I had the working OS, I used the Migration Assistant to rebuild my system from a Time Machine backup. Upon restoring my system, I ended up with MacPorts as a User. I am at a loss to understand why this happened and am wondering if I should get rid of it?

$  port installed
Error: Current platform "darwin 17" does not match expected platform "darwin 16"
Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration
OS platform mismatch
    while executing
"mportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch

I had originally started this computer with macOS Mountain Lion. I'd installed MacPorts when using macOS Sierra. Prior to the crash I had macOS High Sierra 10.13.3 (and that is what I have now).

As I recall, I've only used MacPorts ever to install one thing - I think it was Valgrind (which is not functional in High Sierra - so I don't need it). Of note - there is not a "MacPorts" User that I can login with or see in the Sys Prefs >>> Users & Groups:

enter image description here

...but there is a "macports" directory in /Users/:

enter image description here

Any ideas on why Migration Assistant would create a MacPorts user? Thought on how to and whether or not to nuke it (and any other MacPorts components?)


Update:

I removed MacPorts per their instructions: https://guide.macports.org/chunked/installing.macports.uninstalling.html

...and I removed /opt/local/bin from my $PATH, then deleted /Users/MacPorts.

Upon rebooting, MacPorts is still a User that shows up in the login screen. Also I get the following from dscl:

$  dscl . list /Users | grep -v '^_'
daemon
Guest
macports
mixelpix
nobody
root

How do I get rid of this?

3
  • Darwin 16 is Sierra
    – klanomath
    Mar 28, 2018 at 14:00
  • @klanomath yep. I'd installed MacPorts when I had Sierra. Had upgraded to High Sierra, then the Macbook Air crashed. Thanks!
    – MmmHmm
    Mar 28, 2018 at 14:23
  • The answer also works for Catalina incidentally. I just had the same problem after an upgrade to MacBook Pro 16" (tired of the butterfly keyboard problems). Thanks a lot for asking the question.
    – Pryftan
    Mar 5, 2020 at 12:45

1 Answer 1

42
$  dscl . list /Users | grep -v '^_'
daemon
Guest
macports <--------------------------------------------- remove?
mixelpix
nobody
root

$  /usr/bin/dscl . -search /Users name macports
macports        dsAttrTypeNative:name = (
    macports <----------------------------------------- confirm...
)

$  sudo /usr/bin/dscl . -delete "/Users/macports" <---- DELETE
Password:

$  dscl . list /Users | grep -v '^_' <----------------- GONE!
daemon
Guest
mixelpix
nobody
root

Also useful: sudo ls /var/db/dslocal/nodes/Default/users

Similarly, to delete the group "macports" use:

sudo /usr/bin/dscl . -delete "/Groups/macports"
4
  • This solution does not quite solve the OP's question about the account being a new login option after migration. While this is effective at removing the macports user from a possible account to log in as, it also breaks MacPorts which does need & use the user and group called macports. Fixing this seems to require reinstalling MacPorts. This post from the macports-users list offers some clarity.
    – roens
    Jun 9 at 18:47
  • @roens The OP wanted to remove the macports user after deinstalling MacPorts.
    – nohillside
    Jun 9 at 21:58
  • @nohillside My mistake… and now my earlier comment is too old to edit. Tho the other part of my earlier comment may help someone like myself, wanting to keep using MacPorts after Migration.
    – roens
    Jun 10 at 23:56
  • 1
    @roens you can always post an answer yourself. Just make sure it adresses the question asked as well and stands on its own (so start with how to remove the user, not with „in addition to the other answer“).
    – nohillside
    Jun 11 at 5:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .