How-to: Mounting Additional_Tools_for_Xcode_12.dmg to /DevTools at startup

The Dictionary Development Kit on Additional_Tools_for_Xcode_12.dmg must be installed to /DevTools/Utilities/Dictionary Development Kit/. This is because some of the scripts within the kit have the aforementioned path hardcoded.

A problem arises when we attempt to create /DevTools/Utilities/Dictionary Development Kit/ because the root mount point is read-only as of macOS 10.15.

One solution is to create /DevTools as a mount point, then to automatically mount Additional_Tools_for_Xcode_12.dmg thereto on startup.

To this point, we need to:

  1. create the /DevTools mountpoint,
  2. store Additional_Tools_for_Xcode_12.dmg in a system owned directory, and
  3. have macOS automatically mount the image to /DevTools at startup.

Creating the /DevTools mountpoint

Add a line which reads “DevTools” (without the quotation marks) to the file /etc/synthetic.conf. (If that file does not exist, create it with permission 0644 and change the owners to root:wheel.)

Storing Additional_Tools_for_Xcode_12.dmg in a system owned directory

Move Additional_Tools_for_Xcode_12.dmg to /opt/. Change it’s permission to 0440 and it’s owners to root:wheel.

Having macOS automatically mount the image to /DevTools at startup.

Create a launchd plist under /Library/LaunchDaemons/.

I called mine dk.ingi.petur.devtools.plist.

The permission of that file must be 0644 and the file must be owned by root:wheel.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>dk.ingi.petur.devtools</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/hdiutil</string>
		<string>attach</string>
		<string>-readonly</string>
		<string>-notremovable</string>
		<string>-noverify</string>
		<string>-nobrowse</string>
		<string>-mountpoint</string>
		<string>/DevTools</string>
<string>/opt/Additional_Tools_for_Xcode_12.dmg</string>
    </array>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>

Now you need to restart your mac.

Further reading:

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html

man synthetic.conf

man hdiutil

man launchd.plist

Leave a Reply

Your email address will not be published. Required fields are marked *