My hard drive began writing a lot and I was having to wait a lot to launch apps.

The Activity Monitor told me that launchd had written over 600 megs to the drive.

So I ran this:

sudo lsof -p $(ps -U root | grep -w "/sbin/launchd" | head -1 | awk '{print $1}')

And got this:

launchd   1 root  cwd    DIR                1,4      1088      2 /
launchd   1 root  txt    REG                1,4    339664 499523 /sbin/launchd
launchd   1 root  txt    REG                1,4    698896 499811 /usr/lib/dyld
launchd   1 root  txt    REG                1,4 669073408 912519 /private/var/db/dyld/dyld_shared_cache_x86_64

Is it normal for LaunchD to write over 600 megs of data to /private/var/db/dyld/dyld_shared_cache_x86_64?

Having come from linux where I knew what everything was doing and why it was doing it, I can't seem to find anything that explains this behavior.


Yes, it is normal.

On macOS the system stores a combination of the most recent (i.e. highest version numbers) dynamic libraries (frameworks, etc.) in this cache file in order to speed up the launching of processes later on.

When switching from another OS (like Linux) it is normal that you have to get reacquainted with how the system works. As you'll learn, there's a quite big overlap conceptually between macOS and Linux. Most everything in macOS has a Linux counterpart and vice versa.

In this case the dyld_shared_cache is somewhat similar to the /etc/ld.so.cache file on Linux. On Linux this cache contains the most recent shared libraries, which are essentially the same as dynamic libraries on macOS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .