- shutdown the mac
- start the mac holding the power on button indefinitly
diskutils list internal
# identify the diskxsx device name of the "Macintosh HD" partition
unmount /Volumes/macintosh HD
mkdir /tmp/fs
mount -t apfs /dev/diskxsx /tmp/fs
# do what you want to do
cd /
umount /tmp/fs
rmdir /tmp/fsGet ride of annoying disk ejected notifications
cd /tmp/fs/System/Library/LoginPlugins
rm -rf FSDiconnect.loginPlugin