Mac OS 10.15 or later, defaults command does not create a plist?

Hello, everyone.

I just can't figure it out, so please tell me.


From a user account with a home on the local disk , execute the command

"defaults write/tmp/mnt/test.plist test -bool true"(/tmp/mnt is an NFS or CIFS share)with root privileges.

Then the command appears to be successful on the command prompt, but test.plist is not created.

How Can I solve this problem?

MacBook Air 13″, macOS 11.0

Posted on Feb 3, 2021 1:35 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 3, 2021 2:32 AM

Perhaps if you explain what it is that you are trying to achieve with this one can better assist you.


The defaults command is not typically used with a file path, but with a reverse url, for example


defaults write com.apple.safari something -bool true


would affect the plist for Safari (stored in ~/Library/Preferences).


I have never seen the command used in the form you stated above, and I don't see what it is the purpose, so please explain.

Similar questions

7 replies
Question marked as Top-ranking reply

Feb 3, 2021 2:32 AM in response to umi0817

Perhaps if you explain what it is that you are trying to achieve with this one can better assist you.


The defaults command is not typically used with a file path, but with a reverse url, for example


defaults write com.apple.safari something -bool true


would affect the plist for Safari (stored in ~/Library/Preferences).


I have never seen the command used in the form you stated above, and I don't see what it is the purpose, so please explain.

Feb 3, 2021 6:35 AM in response to umi0817

I don't know if it can write to a file, though it says it could.

This warning in the man page might be pertinent (though I'm not sure if it means what I'm inferring).

WARNING: The defaults command will be changed in an upcoming major release to only
               operate on preferences domains. General plist manipulation utilities will be folded
               into a different command-line program.

Why not just write the plist by hand or use Xcode to create one?

Feb 8, 2021 5:12 AM in response to umi0817

You can generate a skeletal .plist with the following AppleScript:


use framework "Foundation"
use scripting additions

property NSString : a reference to current application's NSString
property NSMutableDictionary : a reference to current application's NSMutableDictionary
property plistname : "~/Desktop/sample.plist"

set out_plist to (NSString's stringWithString:plistname)'s stringByExpandingTildeInPath()

set dict to NSMutableDictionary's dictionaryWithCapacity:1
dict's setObject:"text" forKey:"akey"
dict's writeToFile:out_plist atomically:0
return


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Mac OS 10.15 or later, defaults command does not create a plist?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.