I recently used this method for a customer in Oxford whose 256GB hard drive on their Mac Mini was running out of space. You can re-locate pretty much any folder within macOS to another place (including an external hard drive) by moving the original folder and then creating a symbolic link in its original place.
This is done in the Terminal by running the following command:
ln -s ‘/path/to/relocated/folder’ ‘/path/to/relocated/folder’
For example, if we want to relocate Xcode iOS emulator files from ‘/Users/john/Library/Developer/Xcode/iOS DeviceSupport‘ to ‘/Volumes/Data/Xcode/iOS DeviceSupport‘, close Xcode, move the folder to its new location, and finally run:
ln -s ‘/Volumes/Data/Xcode/iOS DeviceSupport’ ‘/Users/john/Library/Developer/Xcode/iOS DeviceSupport’
This will create a symbolic link ‘/Users/john/Library/Developer/Xcode/iOS DeviceSupport‘ pointing to ‘/Volumes/Data/Xcode/iOS DeviceSupport‘. Xcode will work just like before.
Oxford, Oxfordshire