Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Antony Gabagul
Antony Gabagul
9,351 Points

How to create an user in Mac OSX temrinal

Hey So I have a question on how to do the things you did in the video, just in Mac OSX temrinal. I can't seem to figure it out how to create new users on my computer without treehouse console

Can you please provide a link to the specific video you're referring to?

1 Answer

Robert French
Robert French
2,219 Points

You would use the dscl command in terminal (Directory Service Command Line Utility) For all the dirty details 'man dscl'

There are a few steps to take ...

1) create a new user in the local domain ( / ) under the category users

 dscl / -create /Users/robert

2) create and set the shell property (I like bash)

dscl / -create /Users/robert UserShell /bin/bash

3) set the users full name

dscl / -create /Users/robert RealName "Robert French"

4) create and set the users ID

dscl / -create /Users/robert UniqueID 503

5) create and set the group ID for the user

dscl / -create /Users/robert PrimaryGroupID 1000

6) create and set the new users home directory

dscl / -create /Users/robert NFSHomeDirectory /Local/Users/robert

7) set the password for the new user (change PASSWORD to whatever the actual password will be)

dscl / -passwd /Users/robert PASSWORD

8) (optional) if you want the new user to have admin permissions add them to the admin group

dscl / -append /Groups/admin GroupMembership robert

Hope that helps :-)