Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sun surfer

macrumors regular
Original poster
Jun 6, 2010
105
0
Hi, I've erased my MacBook Pro, re-installed the Snow Leopard OS X and added some applications with a temporary user and am attempting to erase that user so the computer will be "like new". I don't know a lot about this stuff but I found these instructions for the end:

Code:
Software must be installed into root level applications folder (/applications and not ~/applications).

Reboot and hold down command-s.

Enter:
/sbin/fsck -y
/sbin/mount -uw /

Then to delete user account used to install applications:
rm -r /Users/[user's short name]
nicl -raw /var/db/netinfo/local.nidb delete /users/[user's short name]

Then to make machine start set-up assistant again:
rm /var/db/.AppleSetupDone

Then to shut down:
shutdown -h now

Everything worked fine except the line beginning with "nicl". That line brought the response "-sh: nicl: command not found".

I started the machine up again and there was no user, so I created a new one and tried it all again with the new user, and the same thing with the "nicl" line. Again I started it and there was no user, so I'm thinking the line above the "nicl" might erase the user from sight, but the "nicl" line that's actually supposed to erase the user isn't working so those users I've created might be hiding somewhere.

I googled and found that "nicl" and "netinfo" might only work on Leopard and earlier, and that "dscl" might replace it.

How would the line be written with "dscl" instead to make it work to erase a user, or is there some other command that would work?
 

sun surfer

macrumors regular
Original poster
Jun 6, 2010
105
0
nidb appears, but not nicl. Are you manually typing commands?

-Lee

Nidb?

Yes, I'm typing commands into the "root" screen, I think it's called? I restart with command-s and it takes me to a terminal-like black screen where I type in commands.

----------

dscl replaced nicl a long time ago but the syntax is different. Macs don't use Netinfo anymore, and haven't since 10.4.
The entire process to do what you want is different, and longer:
http://hints.macworld.com/article.php?story=20121202080339900

Thanks! That's the type of thing I was looking for. I will try it and hopefully it all works, and I guess I'll have to try it for all the usernames I created to make sure they're all gone even though they seem disappeared for now.
 

sun surfer

macrumors regular
Original poster
Jun 6, 2010
105
0
OK, that link to new directions is not working correctly.

First of all, all its directions start with "$". Why is this? Do I have to put those in? I'm assuming not because I've seen similar directions without the "$". My screen doesn't show a "$" to start every line but rather something that includes the word "root".

OK, the first problem from that link is with this command:

Code:
$ launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist

My computer says something like that is not found and that I should instead use something very similar but with something like "com.apple.DirectoryServices.plist" instead, followed by "localonly" or something. So I did, and this still said nothing was found but now took me out the line where it always began with "root" something and to a line that only begins with ">".

I then tried the next line of command:

Code:
$ dscl . -read /Users/USERNAME GeneratedUID

and all it does is give me this really long list of possible commands to use (so long the top is cut off by the screen and I have no idea how to scroll up to see the top).

So that's where I'm stuck at now. I read some of the comments from the link before trying and they all say how it works well if they used it, so how is this happening to me? I'm following the instructions closely and wrote everything exactly as told to do.


ETA - That link mentions Lion and Mountain Lion. I assumed since chrfr linked me and since Snow Leopard is included with those as the "post-nicl" os xs, that they would work the same way with Snow Leopard. But now I'm wondering if those commands are only for Lion/Mountain Lion. If so, what will work for Snow Leopard?
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,560
6,059
$ or > are commonly used to represent prompt, which may look like whatever you program it to look like.

The default shell in Terminal is, I think, Bash, which normally includes the user name, the current directory, and a > in the prompt.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,743
8,417
A sea of green
Don't type the $ .

When they show the $, that's the prompt. You're supposed to type what comes after the $ .


When you say "I found instructions ..." it's always a good idea to post where you found them. That is, post the exact URL of what you're referring to.

Like if you said "I read in a book ...", it's a good idea to tell us what the title and author of the book is. So we're all reading from the same book.

----------

The default shell in Terminal is, I think, Bash, which normally includes the user name, the current directory, and a > in the prompt.

No, the default prompt contains name, directory, and $ as the end of the prompt.

The > prompt means a continuation line, like an unclosed quote, or a previous line ending with backslash-newline.

And the default prompt when running as the root user is # .
 

sun surfer

macrumors regular
Original poster
Jun 6, 2010
105
0
Don't type the $ .

When they show the $, that's the prompt. You're supposed to type what comes after the $ .


When you say "I found instructions ..." it's always a good idea to post where you found them. That is, post the exact URL of what you're referring to.

Like if you said "I read in a book ...", it's a good idea to tell us what the title and author of the book is. So we're all reading from the same book.


Thanks for the "$" explanation.

I honestly don't know where I found those instructions. Days ago I went looking for instructions on the entire process of erasing a computer to make it like new, and those were just one. I copied and pasted them into a Pages document along with others, then decided to use those for the endgame because they were a way to add back the applications and still have the laptop start like new. I just now tried googling for them using some of the commands in quotations but it's not showing up on google so I don't know. But suffice it to say, I copied the important parts here, and they all worked except that one line, and it's already been established that the one line is too old, from 10.4 and before while I'm using 10.6. So now the issue is finding some other commands to work.

However, the instructions I was just trying today that aren't working were from the link that chrfr gave me above from the macworld article. Those aren't working right but they're way too long to copy and paste in full so you can click on the link to see the full instructions I was working from, but I did paste the relevant commands when they stopped working. My guess is that the problem is that those instructions are for 10.7 and above, while the old instructions from the first post of mine are from 10.4 and below, which basically leaves correct instructions for my 10.6 in the dust.

I went searching some more and did finally find this not long ago:https://forums.macrumors.com/threads/1140591/

Specifically the last post there (4), which is apparently some instructions for the same thing for 10.6. I just tried them and they sort of seem to work. But I've already done so much other, I'm not sure (like some things were already erased beforehand). The "launchctrl" command worked properly

Code:
$ /bin/launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist

unlike with the linked instructions from chrfr.

And then this command seemed to work the first time:

Code:
$ dscl . -delete /Groups/admin GroupMembership <username>

Which is good, since I used the username of one of the users that had "disappeared" using the directions in my first post, so it was good to know it was hiding somewhere and is now gone.

However, when I tried it for the other users, it didn't work, just saying the directory is already loaded. So my best guess is that hopefully, that command erased all the admin users and not just the one username I added at the end of the line.

I did run this line first too from the last link:

Code:
$ rm -R /Library/Preferences/

Which wasn't in either of the other sets of directions. Hopefully it won't mess anything up; I'm just guessing it's erasing library preferences in case I set any while using a temporary user to install applications.

So, basically, I'm still sort of lost as to what to do exactly with all these competing instructions and none working exactly right, but the feeling I'm getting is that maybe I've now done enough and basically the users are deleted and it's good to go?
 

chrfr

macrumors G5
Jul 11, 2009
13,518
7,042
I dug out my own notes on this. Your guess is correct:
/System/Library/LaunchDaemons/com.apple.DirectoryServices.plist is on Leopard and Snow Leopard while Lion and later use /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist.

So for Leopard and Snow Leopard, do the following:
First, boot into Single User Mode. Then type each of the following lines into the prompt.
Code:
mount -uw /
rm -R /Library/Preferences

rm -R /Users/username/

rm /var/db/.AppleSetupDone

/bin/launchctl load 

/System/Library/LaunchDaemons/com.apple.DirectoryServices.plist &

dscl . -delete /Users/username

dscl . -delete /Groups/admin GroupMembership username

shutdown -h now
 

sun surfer

macrumors regular
Original poster
Jun 6, 2010
105
0
Thanks chrfr. That's similar to what I did from the last link I included and now when I try it, it's acting like there is nothing there to delete at that part. Iinstead of seeming to run the delete commands, it's just saying that the directory is already loaded so I'm assuming that means there's nothing there to delete now?
 

chrfr

macrumors G5
Jul 11, 2009
13,518
7,042
Thanks chrfr. That's similar to what I did from the last link I included and now when I try it, it's acting like there is nothing there to delete at that part. Iinstead of seeming to run the delete commands, it's just saying that the directory is already loaded so I'm assuming that means there's nothing there to delete now?

If you've already loaded Directory Services and haven't rebooted since, you do not need to reload it. With Directory Services loaded, you can type the following to see if that user is there. You will get a long list of names but near the bottom would be the accounts you created.
Code:
dscl . -list /Users
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.