I’ve found that more than a fair share of preferences are stored for each specific user on a computer. I’ve also found that some preferences are stored in a “ByHost” folder in /Users//Library/Preferences. Anything stored in the ByHost folder has the hardware UUID in the plist file name.
/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c20-57This line will pull the hardware UUID number so that it can be used in a defaults read/write script or something like that. You probably already know this, but it seems like a good tip to include on a website. I needed to do this to turn off “Discoverable” mode for bluetooth.
defaults write /Users/<user>/Library/Preferences/ByHost/com.apple.Bluetooth.`/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57` DiscoverableState -bool no launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist launchctl load /System/Library/LaunchDaemons/com.apple.blued.plistIf using in a login script (via managed prefs), it would look like this:
uuid=`/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57` /usr/bin/defaults write /Users/$@/Library/Preferences/ByHost/com.apple.Bluetooth.$uuid DiscoverableState -bool no /usr/sbin/chown $@ /Users/$@/Library/Preferences/ByHost/com.apple.Bluetooth.$uuid.plistThis script will turn discoverablestate to “off” and relaunch the bluetooth service.
krypted September 23rd, 2011