Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac OS X New Users From Command Line

I need to add a new user via the command line in single-user mode. I reinstalled OS X earlier, and for some reason, it didn't create my user account properly. Now I can't log in. So I'm wondering how exactly I can go about creating a new user account without reinstalling everything.

I tried this, but it didn't work: http://osxdaily.com/2007/10/29/how-to-add-a-user-from-the-os-x-command-line-works-with-leopard/

Thanks in advance.

like image 937
Collin Klopfenstein Avatar asked May 13 '09 02:05

Collin Klopfenstein


People also ask

How do I get to the Users folder on Mac terminal?

If you type cd / , you'll go to the root level of your startup disk. If you type cd .. (that's two periods), you'll go to the directory above the one you're currently in. So if you're in your home folder, and type cd .. , you'll go to your Mac's /Users folder.

How do I find Users on a Mac?

To see your existing user accounts, go to System Preferences > Users & Groups. This preference pane shows a list of existing user accounts, lets you create new accounts, and it also lets you set a number of login options. Start by looking at your own user account; it's at the top of the list under Current User.


1 Answers

rm /var/db/.AppleSetupDone

...and then reboot normally. With that file gone, OS X launches its first-run Setup Assistant and (among other things) lets you create a new account.

BTW, the reason niutil isn't there has nothing to do with whether it's a server or not -- it's because Apple got rid of NetInfo (its old database for storing local users) in 10.5, and replaced it with a new XML-based system. If you want to do niutil-ish things in 10.5, you can either use dscl (this is actually a bit complicated in single-user mode because directory services aren't running) or create/edit the XML files by hand.

like image 133
Gordon Davisson Avatar answered Sep 23 '22 03:09

Gordon Davisson