Note: This answer was also tested using High Sierra.
The macOS Recovery for newer versions of macOS do include the xattr
command. Going back to Mavericks, I find that the xattr
command is not included in OS X Recovery. However, if while booted to OS X Recovery for Mavericks, you have a working Mavericks installed, then you still can use the xattr
command that was included with Mavericks. The image below was taken while booted to OS X Recovery for Mavericks. This image shows Mavericks is installed on the Macintosh HD
volume.
The commands below were entered in a Terminal window while booted to OS X Recovery for Mavericks.
Below is the output from the echo $PATH
command.
/usr/bin:/bin:/usr/sbin:/sbin
Below is the output from the ls /Volumes/Macintosh\ HD/usr/bin/xattr
command.
/Volumes/Macintosh HD/usr/bin/xattr
So the xattr
command would be in the search path for commands, if the colon‑separated list of directories output by echo $PATH
were proceeded with /Volumes/Macintosh\ HD
. As the OP has pointed out, other software (such as python) may need to be included in this path. This can be accomplished by proceeding the xattr
command with the chroot
command, as shown below.
chroot "/Volumes/Macintosh HD" xattr
In this case the chroot
command changes its root directory to the supplied directory "/Volumes/Macintosh HD"
.
Example When Accessing a File in the Current Working Directory
If the current working directory contained the file test.txt
, then the following command would not work. (Unless the current working directory was /Volumes/Macintosh HD
.)
chroot "/Volumes/Macintosh HD" xattr -c test.txt
However, the following command would cause all attributes to be removed from the file test.txt
.
chroot "/Volumes/Macintosh HD" xattr -c "$PWD/test.txt"
Using $PWD
works in the above command, because /Volumes/Macintosh HD/Volumes/Macintosh HD
is a symbolic link to /
.
How to Remount When Necessary to Access One or More Files
Note: Any remounting only persists until the Mac restarts.
If one or more files to be accessed do not reside in the Mavericks startup volume, then the mount point for each of these other volumes will need to be moved to the Mavericks startup volume. For example, if the test.txt
file is stored in the MyHFS
volume instead of in the Macintosh HD
volume, then you will need to remount the MyHFS
volume. First, enter the command below to unmount the MyHFS
volume.
diskutil unmount MyHFS
Example output is shown below.
Volume MyHFS on disk1s3 unmounted
Next, use the commands below to insure the new mount point exists in the Macintosh HD
volume, then mount the MyHFS
volume at that point. The identifier disk1s3
that is entered should be the same as shown in the above output.
mkdir -p /Volumes/Macintosh\ HD/Volumes/MyHFS
diskutil mount -mountpoint /Volumes/Macintosh\ HD/Volumes/MyHFS disk1s3
Example output is shown below.
Volume MyHFS on disk1s3 mounted