Writing to the macOS system partition
With macOS Catalina and newer, Apple split the OS and user data into 2 volumes where the system volume is read-only by default. To make these drives writable we'll need to do a few things:
macOS Catalina
Disable SIP
Mount drive as writable (Run sudo mount -uw / in terminal) macOS Big Sur
Disable SIP
Mount drive as writable (See below link for command)
Note: Due to how OS updates work in macOS Big Sur and newer, changing the system volume can in fact break OS updates. Please edit with caution
Commands based off of Apple's KDK documents:
# First, create a mount point for your drive
mkdir ~/livemount
# Next, find your System volume
diskutil list
# From the below list, we can see our System volume is disk5s5
/dev/disk5 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +255.7 GB disk5
Physical Store disk4s2
1: APFS Volume Big Sur HD - Data 122.5 GB disk5s1
2: APFS Volume Preboot 309.4 MB disk5s2
3: APFS Volume Recovery 887.8 MB disk5s3
4: APFS Volume VM 1.1 MB disk5s4
5: APFS Volume Big Sur HD 16.2 GB disk5s5
6: APFS Snapshot com.apple.os.update-... 16.2 GB disk5s5s
# Mount the drive(ie. disk5s5)
sudo mount -o nobrowse -t apfs /dev/disk5s5 ~/livemount
# Now you can freely make any edits to the System volume
# If you edited either the S*/L*/Kernel, S*/L*/Extensions or L*/Extensions,
# you will need to rebuild the kernel cache
sudo kmutil install --volume-root ~/livemount --update-all
# Finally, once done editing the system volume we'll want to create a new snapshot
sudo bless --folder ~/livemount/System/Library/CoreServices --bootefi --create-snapshot