Skip to content

Instantly share code, notes, and snippets.

@trinhpham
Last active October 11, 2024 01:38
Show Gist options
  • Save trinhpham/a55eb84ec9b49c1787ff6e994cbe8526 to your computer and use it in GitHub Desktop.
Save trinhpham/a55eb84ec9b49c1787ff6e994cbe8526 to your computer and use it in GitHub Desktop.
Not auto mount other mac volume
#!/bin/bash
# Expected to be run as root
# curl -Lso- https://gist.githubusercontent.com/trinhpham/a55eb84ec9b49c1787ff6e994cbe8526/raw/disable-volume-mount-macos.sh | sudo bash -s -- "Macintosh HD - Data"
VOLUME_NAME="${1:-'Macintosh HD2 - Data'}"
echo "Start working with volume: $VOLUME_NAME"
VOLUME_ID=$(diskutil list | grep "$VOLUME_NAME" | awk '{print $NF}')
VOLUME_UUID=$(diskutil info $VOLUME_ID | ggrep -oP "Volume UUID:[[:space:]]+\K.*")
if [ -n "$VOLUME_UUID" ]; then
echo "UUID=$VOLUME_UUID none apfs rw,noauto" >> /etc/fstab
fi
cat /etc/fstab
automount -vc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment