How to stop system from automatically loading DirectoryServicesLocal

Joined
Feb 18, 2014
Messages
2
Reaction score
0
Points
1
Hello.

I am new to these forums and I apologize if I am posting this in the wrong section. I am having a bit of a problem executing dscl commands in single user mode on Mac OS X 10.6.8.

I am working on a shell script for creating user accounts. The reason for this is because we have a lot of Macs at our office and I find it much easier and quicker to simply boot into single user mode, mount the flash drive and run this script than to boot into the GUI and manually create accounts in the System Preferences window (or running the script from Terminal).

However, I noticed some strange behavior. After loading /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist with launchctl, the system seems to automatically load /System/Library/LaunchDaemons/com.apple.DirectoryServicesLocal.plist as well after running the first dscl command. The reason why this is a problem is because every subsequent dscl command produces the error message "com.apple.DirectoryServicesLocal.plist: Already loaded". Because my script runs several dscl commands to create user accounts as well as to verify if a user name is already in use, etc, this produces a rather unnecessary flood of error messages on the screen. While the commands themselves execute successfully, I would prefer to stop this flood of error messages complaining that DirectoryServicesLocal.plist is already loaded.

One workaround I've found is to unload DirectoryServicesLocal.plist after every dscl command, but this is not very elegant and makes the script run a bit slower and less efficiently as it has to unload the plist after every command.

Is there an elegant solution for this problem? I've tried searching Google about this issue, and there are apparently many people experiencing the same problem but I have not been able to find an actual solution for this other than the dirty workaround I mentioned above...

I'd really appreciate some help with this.

Thanks!

P.S.

Just to be clear, I *am* loading /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist, NOT /System/Library/LaunchDaemons/com.apple.DirectoryServicesLocal.plist. The system seems to automatically load this after the first dscl command is executed after loading /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist, which is what I am trying to prevent as it produces error messages complaining that the plist is already loaded with every subsequent dscl command.
 
OP
A
Joined
Feb 18, 2014
Messages
2
Reaction score
0
Points
1
Sorry to bump this thread like this but there hasn't been any responses... Does anyone know how to resolve this? Should I perhaps repost this thread in a different section such as the programming section?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top