什么是cfprefsd,为什么它在我的Mac上运行?

You’re browsing Activity Monitor when you notice something named cfprefsd. What is this, and should you be worried about it?

当您发现名为cfprefsd的内容时,您正在浏览活动监视器 。 这是什么,您应该为此担心吗?

Quick answer: No, cfpresfd is a core part of macOS, and you couldn’t use your computer without it.

快速解答:不,cfpresfd是macOS的核心部分,没有它,您将无法使用计算机。

This article is part of our ongoing series explaining various processes found in Activity Monitor, like kernel_task, hidd, mdsworker, installd, WindowServer, blued, launchd, backup, opendirectoryd, powerd, coreauthd, configd, mdnsresponder, UserEventAgent, nsurlstoraged, commerce, parentalcontrold, sandboxd, cloudd, and many others. Don’t know what those services are? Better start reading!

这篇文章是一部分我们正在进行一系列的解释活动监视器中发现的各种Craft.io,比如kernel_taskhiddmdsworkerINSTALLDWindowServer发蓝launchd会备份opendirectoryd的powerdcoreauthdconfigdmdnsresponderUserEventAgentnsurlstoraged商业parentalcontrold沙盒乌云密布 等等 。 不知道这些服务是什么? 最好开始阅读!

Today’s process, cfprefsd, is a daemon, which means it runs in the background and handles system tasks. You can generally identify daemons by the “d” at the end. This specific daemon allows macOS and your applications to read and write preferences files.

当今的过程cfprefsd是一个守护程序,这意味着它在后台运行并处理系统任务。 通常,您可以在最后用“ d”标识守护程序。 这个特定的守护程序允许macOS和您的应用程序读取和写入首选项文件。

cfprefsd做什么 (What cfprefsd Does)

To quote the man page, which you can view by typing man cfprefsd in Terminal:

要引用手册页,您可以在终端中输入man cfprefsd来查看该手册页:

cfprefsd provides preferences services for the CFPreferences and NSUserDefaults APIs.

cfprefsd为CFPreferences和NSUserDefaults API提供了首选项服务。

That’s a little confusing if you don’t know what CF Preferences and NSUserDefaults are, so let’s dig into those briefly.

如果您不知道什么是CF Preferences和NSUserDefaults,那会有点令人困惑,所以让我们简要地研究一下。

The CF in CFPreferences stands for Core Foundation. According to Apple’s developer documentation, Core Foundation is how your Mac manages both system-wide and application-specific preferences:

CFPreferences中的CF代表Core Foundation。 根据Apple的开发人员文档 ,Core Foundation是Mac如何管理系统范围和特定于应用程序的首选项的方式:

Core Foundation provides a simple, standard way to manage user (and application) preferences. Core Foundation stores preferences as key-value pairs that are assigned a scope using a combination of user name, application ID, and host (computer) names. This makes it possible to save and retrieve preferences that apply to different classes of users.

Core Foundation提供了一种简单的标准方法来管理用户(和应用程序)首选项。 Core Foundation将首选项存储为键值对,并使用用户名,应用程序ID和主机(计算机)名的组合为其分配了范围。 这样就可以保存和检索适用于不同类别用户的首选项。

Basically, anytime your computer creates or edits a .plist file inside the hidden Library folder on your Mac, it’s CFPreferences that makes that happen.

基本上,只要您的计算机在Mac上隐藏的Library文件夹内创建或编辑.plist文件,CFPreferences便会实现。

NSUserDefaults, meanwhile, is a related system that allows programs to access your default settings. If you’ve set up your computer to use Inches and Celsius, I’m confused by your choices. Your applications aren’t, however, because they can use NSUserDefaults to learn what options you’ve selected. To quote the Apple Developer documentation again:

同时,NSUserDefaults是一个相关的系统,允许程序访问您的默认设置。 如果您已将计算机设置为使用英寸和摄氏度,那么您的选择会让我感到困惑。 但是,您的应用程序不是,因为它们可以使用NSUserDefaults来了解您选择了哪些选项。 要再次引用Apple Developer文档

The NSUserDefaults class provides a programmatic interface for interacting with the defaults system. The defaults system allows an app to customize its behavior to match a user’s preferences. For example, you can allow users to specify their preferred units of measurement or media playback speed. Apps store these preferences by assigning values to a set of parameters in a user’s defaults database.

NSUserDefaults类提供了用于与默认系统进行交互的编程接口。 默认系统允许应用程序自定义其行为以匹配用户的首选项。 例如,您可以允许用户指定其首选的度量单位或媒体播放速度。 应用程序通过将值分配给用户默认数据库中的一组参数来存储这些首选项。

To summarize: cfprefsd is a daemon used by macOS and applications to create and edit preferences files. It’s also used to make sure applications respect your system-wide default settings.

总结一下:cfprefsd是macOS和应用程序用来创建和编辑首选项文件的守护程序。 它还用于确保应用程序遵守系统范围的默认设置。

cfprefsd用尽CPU功率时该怎么办 (What To Do If cfprefsd Is Using Up CPU Power)

This process shouldn’t be using up a lot of CPU power, because it has a fairly simple job. If it is, the culprit is likely an application you installed recently. As we’ve said, cfprefsd is used by both macOS and your individual applications.

这个过程不应该消耗很多CPU资源,因为它的工作非常简单。 如果是这样,则可能是您最近安装了一个应用程序。 如前所述,macOS和您的单个应用程序都使用cfprefsd。

If you recently installed something, try closing that app and seeing if it helps. If it does, you might be dealing with a corrupted .plist file. Consider wiping that app’s settings by using AppCleaner, or by manually deleting any .plist files you find for the application from the Library folder. If that doesn’t help, you’ve found a bug; get in touch with the developer of the problematic app.

如果您最近安装了某些东西,请尝试关闭该应用程序,看看是否有帮助。 如果是这样,您可能正在处理损坏的.plist文件。 考虑使用AppCleaner擦除该应用程序的设置 ,或者手动从Library文件夹中删除为该应用程序找到的任何.plist文件。 如果那没有帮助,则说明您发现了一个错误。 与有问题的应用程序的开发人员联系。

Photo credit: guteksk7/Shutterstock.com

图片来源: guteksk7 / Shutterstock.com

翻译自: https://www.howtogeek.com/346093/what-is-cfprefsd-and-why-is-it-running-on-my-mac/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值