net/_posts/2007-08-02-mac-os-x-from-the-command-line.md

23 lines
1.5 KiB
Markdown
Raw Normal View History

2012-01-02 23:33:14 -05:00
---
layout: post
title: Mac OS X from the command line
created: 1186083889
permalink: blog/walkah/mac-os-x-command-line
tags:
- mac os x
- cli
- adduser
---
2012-01-03 00:31:54 -05:00
<p>Dear Apple, I love you, but sometimes you drive me up the wall.</p>
<p>I've been playing around with a little project to set up sandbox drupal sites on a mac mini (more details on that later) ... that's easy stuff, but the annoying part is: I'd like to share directories via <a href="http://www.samba.org/">Samba</a> which needs system accounts. The trick is, I want to add all of this via a simple little shell script. No problem right? Simple one line call to <code>useradd</code>... right?! Noooooooooo. Not in OS X. No, in OS X <em>this</em> is how you <a href="http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/additionalfeatures/chapter_10_section_9.html#//apple_ref/doc/uid/TP40002856-BBCDBFBD">add user accounts from the commandline</a> (which, of course, is under "Porting unix/linux applications"):</p>
<pre>
# dscl / -create /Users/portingunix
# dscl / -create /Users/portingunix UserShell /bin/bash
# dscl / -create /Users/portingunix RealName "Porting Unix
# dscl / -create /Users/portingunix UniqueID 503
# dscl / -create /Users/portingunix PrimaryGroupID 1000
# dscl / -create /Users/portingunix NFSHomeDirectory /Local/Users/portingunix
# passwd portingunix
</pre>
2012-01-02 23:33:14 -05:00
<p>I dunno... I think that's just annoying. Perhaps NetInfo has some beauty that I'm just don't understand, but, couldn't Apple at least ship with some standard <code>useradd</code> wrappers or something?</p>