How to edit system files on macOS

Prerequisites

Preparing the USB Drive

The only way to edit system files, also with SIP disabled, is making it from a macOS USB installer.

You need to have a macOS installer to make a macOS USB; it's not necessary to have the latest macOS on the USB drive.

Learn more
Check out my script

Booting from the USB Drive

To boot from the USB drive, restart your Mac and hold down the Option (⌥) key while it boots up. This will bring up the Startup Manager, where you can select the USB drive as the boot device.

Once you've selected the USB drive, your Mac will boot into the macOS installer. From there, you can go to Utilities -> Terminal to make the necessary changes to the system files.

Mount the macOS disk correctly

Once in terminal, you have first to know which disk is your macOS installation. You can do this by diskutil list

You can recognize your disk by seeing partitions like Macintosh HD or (your disk name) - Data. Also is usually the disk1

Once you found the disk number, type diskutil unmountDisk /dev/diskX (replace X with your disk number) to unmount the disk.

Now we have to mount the system partition, so (Macintosh HD, but not with "- Data"), is usually the partition 1

So type before mkdir /Volumes/SystemRoot (<--- or whatever name you prefer) mount -t apfs -o nobrowse,rw /dev/diskXs1 /Volumes/SystemRoot (or what you choosed before)

Now when you mounted the system partition, you can access it at /Volumes/SystemRoot (or what you choosed before).

Now you can edit the system files as needed. You can also type diskutil mount /dev/diskXs4 for browsing in your personal files.

Once you have finished to edit files, type bless --folder /Volumes/SystemRoot/System/Library/CoreServices --bootefi --createSnapshot

Now you can restart and boot into your macOS installation.