Last active
October 11, 2024 01:38
-
-
Save trinhpham/a55eb84ec9b49c1787ff6e994cbe8526 to your computer and use it in GitHub Desktop.
Not auto mount other mac volume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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