Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Linux, if I want to change a user's home directory, I can use the usermod command:

usermod [-c comment] [-d home_dir [-m]]

[-e expire_date] [-f inactive_time] 
[-g initial_group] [-G group [,...]] 
[-l login_name] [-p passwd] 
[-s shell] [-u uid [-o]] [-L|-U] login

Is there any equivalent command in OS X?

share|improve this question
Do you want to change your account name/home directory name? – Michiel Mar 29 '12 at 12:52
This question has been asked before ;). Try dscl (man dscl). For examples look at:… – user1256923 Mar 29 '12 at 12:57

Since my original answer got transformed in a comment due to it's brevity, here is another go.

The command that you are looking for is dscl on OSX (which works both in OS 10.6 and 10.7 in my experience). As I mentioned this question has been asked before, and you can find the original answer (plus usage examples) on stackExcjange superUser forum at:

which provides a number of examples for its use. For instance, adding a user to a group would work as:

dscl . append /Groups/the_group_you_want GroupMembership the_user

In addition, someone did provide a bash script that does what usermod does on linux, and you can find it here:

(I haven't tested it, so it comes with no guarantees).


share|improve this answer
I'm looking for usermod -u, changing UID of user and migrating UID of its files. dscl can't do this. – CharlesB Mar 29 '12 at 13:49
@CharlesB have a look at this page then: it's possibly more fiddly than pure usermod -u but as good at it seems to get – user1256923 Mar 29 '12 at 15:56
very nice! thanks – CharlesB Mar 29 '12 at 16:01

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.