You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Why are trustd, nsurlsessiond, syslogd causing high CPU on Mac?

The syslogd high CPU I am pretty sure is a result of the excess logging coming from trustd and nsurlsessiond.

In console I am getting the same 3 messages logged constantly:

error	11:38:11.053373-0700	nsurlsessiond	Failed to obtain user-directory, errno: 5
error 11:38:11.053484-0700 nsurlsessiond Process with bundleID <private> [pid 222] does not have a bundle path, rejecting connection
error 11:38:11.053661-0700 trustd obliterateAllSessionsWithReply error handler called with error Error Domain=NSCocoaErrorDomain Code=4097 UserInfo={NSDebugDescription=<private>}
error 11:38:11.054331-0700 nsurlsessiond Failed to obtain user-directory, errno: 5


This reoccurs every millisecond or so and has been occurring since Catalina was installed. Originally after a reinstall I was running Mountain Lion and then did a bridging upgrade to Mavericks to get to Catalina. I also thought this might be due to not having iCloud setup so I logged it in but didn't change the problem.




[Re-Titled by Moderator]

Posted on Apr 8, 2020 11:42 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 30, 2020 9:27 AM

Hi flipflips, I followed Jeremy's instructions, and now the issue is solved. So let me explain how to do this in more detail.


But before taking off: beware that tinkering with the Mac system using the Terminal is risky business. I had a long conversation with Apple Care, who took me through a lot of steps, and they in general advise to NOT use Terminal.

So, make sure to have a backup of all your files, and check the contents of the log-files to check that your issue is caused by exactly the same issue that Jeremy reported. That is how I did it, and it worked for me.


And if your system gets unstable, you can always go back to factory defaults, and start over from there :)


Now, first we will check the log files.

To do this, start Spotlight (the looking-glass symbol in the upper righthand corner of the screen) and type:


/var/log/asl


This brings up a Finder window with the folder with the log-files.

Those log-files have a name like:


2020.06.30.xxx.asl


You can open the log-file with the program Console (that is the default program, or you can use Open with...)


Check this log-file for lines as:


libcoreservices: __makeDirectory: 405: mkdir: path=/var/folders/zz/[randomized name]/0/ mode=0755: Operation not permitted.


The [randomize name] part is a long string like zyxvpxvq6csfxvn_n00000y800007k


This string is important: it is the name of a system subdirectory that is used by the nsurlsessiond process. Nsurlsessiond tries to write to this directory, but gets no permission, and repeats and repeats and repeats and repeats. That's why nsurlsessiond stays in the top of your list of processes, eating up to 50-60% of your CPU capacity, draining your battery, and heating your MacBook.


So check if you see these lines in your log file, to make sure your issue is the same.


To solve the issue you have to do 2 things:

  1. Kill the trustd process
  2. Delete the blocked directory, so that the OS can create a new one.


These things are done using the Terminal. You can find this program in the Launchpad, or find it using Spotlight.


First, find the name of the subdirectory (the string mentioned above). Copy it from the log-file, or find it using the Terminal.


Start the Terminal program. The Terminal window opens. After the prompt, type:


ls -la /var/folders/zz | grep nsurlsessiond


You will get an output like:


drwxr-xr-x@  5 _nsurlsessiond    _nsurlsessiond     160  9 jun 13:45 zyxvpxvq6csfxvn_n00000y800007k


The part that I made bold is the name of the subdirectory we need to delete, so copy this to your Clipboard.


Now, take a look again at the Activity monitor, and look for the trustd process, that is one of the top 3 or 4 processes in the list. It has a unique process id, the PID number (for example 219).


In Terminal, kill the trustd process, by typing:


sudo kill -9 [trustd PID]


So if the PID is 219, you type:


sudo kill -9 219


After killing this process, you will see the CPU usage drop immediately.


Now we delete the subdirectory. Again in Terminal, type


sudo rm -fr /var/folders/zz/[randomized name]


Again, replace [randomized name] with the string you copied before.


Congratulations, you are done!


Keep following your system performance for several days in the Activity Monitor.


Success!




Similar questions

125 replies

Apr 15, 2020 7:21 AM in response to jeremywohl

Let me give it 24 hours but this looks like it solve things for me.


Directory before deletion:

Jamess-Mac-mini:~ jdp$  ls -la /var/folders/zz | grep nsurlsessiond
drwxr-xr-x   4 _nsurlsessiond   _nsurlsessiond   128 Mar 29 15:42 zyxvpxvq6csfxvn_n00000y800007k
Jamess-Mac-mini:~ jdp$ ls -lah /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k
total 0
drwxr-xr-x   4 _nsurlsessiond  _nsurlsessiond   128B Mar 29 15:42 .
drwxr-xr-x@ 25 root            wheel            800B Mar 30 07:47 ..
drwx------   3 _nsurlsessiond  _nsurlsessiond    96B Mar 29 15:42 C
drwx------   3 _nsurlsessiond  _nsurlsessiond    96B Apr 14 09:42 T


After deletion:

Jamess-Mac-mini:~ jdp$ ls -la /var/folders/zz | grep nsurlsessiond
drwxr-xr-x@  5 _nsurlsessiond   _nsurlsessiond   160 Apr 14 18:32 zyxvpxvq6csfxvn_n00000y800007k
Jamess-Mac-mini:~ jdp$
Jamess-Mac-mini:~ jdp$ ls -la /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k
total 0
drwxr-xr-x@  5 _nsurlsessiond  _nsurlsessiond  160 Apr 14 18:32 .
drwxr-xr-x@ 25 root            wheel           800 Apr 14 18:32 ..
drwxr-xr-x@  3 _nsurlsessiond  _nsurlsessiond   96 Apr 14 18:32 0
drwx------   3 _nsurlsessiond  _nsurlsessiond   96 Apr 14 18:32 C
drwx------   3 _nsurlsessiond  _nsurlsessiond   96 Apr 14 18:32 T


The only difference seems to be some extended attributes were missing from the directory and now have been added (@ after the permissions).

Jamess-Mac-mini:~ jdp$ xattr -l /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k
com.apple.rootless: folders


I am guessing these attributes were meant to be added over an upgrade but never made it?

Apr 17, 2020 9:00 AM in response to biofed

Open the "Activity Monitor" app.

Locate the "trustd" process in the left column.

Find its PID in the "PID" column, it should be an integer.


Open the "Terminal" app.

Copy the following command, replacing "[trustd PID]" with the PID you just found:

sudo kill -9 [trustd PID]

and run it (press "Return")


Still in "Terminal", copy and run the following command:

ls -la /var/folders/zz | grep nsurlsessiond

The name in the last column is the name you need to replace "[randomized name]" with in the next and last command to run:

sudo rm -fr /var/folders/zz/[randomized name]


That's it, you're done!

Apr 17, 2020 9:21 AM in response to mathieu105

This is what happened:


Fede@MacBook-Pro-2 ~ % sudo kill -9 378         


Password:


Fede@MacBook-Pro-2 ~ % ls -la /var/folders/zz | grep nsurlsessiond


drwxr-xr-x@  5 _nsurlsessiond   _nsurlsessiond   160 29 Giu  2019 zyxvpxvq6csfxvn_n00000y800007k


Fede@MacBook-Pro-2 ~ % sudo rm -fr /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k


rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/0/com.apple.nsurlsessiond: Operation not permitted


rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/0: Operation not permitted


rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/T/com.apple.nsurlsessiond/TemporaryItems: Operation not permitted


rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/T/com.apple.nsurlsessiond: Directory not empty


rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/T: Operation not permitted


rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/C: Operation not permitted


rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k: Operation not permitted


Fede@MacBook-Pro-2 ~ % 

Apr 26, 2020 11:54 AM in response to PabloGonCasal

Open the "Activity Monitor" app.

Locate the "trustd" process in the left column.

Find its PID in the "PID" column, it should be an integer.


Open the "Terminal" app.

Copy the following command, replacing "[trustd PID]" with the PID you just found:

sudo kill -9 [trustd PID]

and run it (press "Return")


Still in "Terminal", copy and run the following command:

ls -la /var/folders/zz | grep nsurlsessiond

The name in the last column is the name you need to replace "[randomized name]" with in the next and last command to run:

sudo rm -fr /var/folders/zz/[randomized name]


That's it, you're done!

May 4, 2020 7:21 AM in response to jpaussa

so got this same problem. but sudo rm doesn't work. i get below:


rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/0/com.apple.nsurlsessiond/com.apple.nsurlsessiond: Operation not permitted
rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/0/com.apple.nsurlsessiond: Directory not empty
rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/0: Operation not permitted
rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/T: Operation not permitted
rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/C: Operation not permitted
rm: /var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k: Operation not permitted


before you ask terminal + zsh already has full disk access. unless do i need to reboot after assign?




May 13, 2020 5:09 AM in response to MrPablo14

You can do this two different ways.... you can navigate to the /var/log/asl folder via Terminal, and then run remove file commands on the appropriate files. In theory there files don't matter since they're just logs, but make sure you know what you're doing before removing anything you might need. An even easier way is to just navigate to the /var/log/asl folder from Finder, and then move these files to the trash. I was finding the nsurlsessiond process was creating 25MB log files every 1-2 minutes, and it was hijacking my computer's storage. Not only that, the process itself was draining my battery. Once I followed the info mathieu105 posted, I was able to stop these logs from accruing.

May 13, 2020 9:21 PM in response to jpaussa

I also have this problem but I do not want to risk doing something wrong when working in the terminal. Are there any other possible solutions people have found? Has is worked for anyone to downgrade to an older OS or to reinstall Catalina? I moved from El Capitan to Catalina only a few days ago, but I am curious if this problem occurred in other operating systems. I am going to contact Apple support the next time nsurlsessiond starts using mass CPU to see if they can help while it is happening. This seems like pretty common issue so I am hoping Apple makes a patch to fix this soon.

May 17, 2020 8:07 AM in response to jeremywohl

hi there - any chance you could expand this a bit for me? i have very little experience with these functions

same issue as described- catalina update on 2012 macbook pro and nsurlsessiond, trustd, syslogd using up cpu

(and I don't even know what they do)

tried to follow your strategy but it's a bit over my head - when entering commands into terminal nothing seems to happen, guess i'm doing it wrong... thanks

Why are trustd, nsurlsessiond, syslogd causing high CPU on Mac?

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