I tried your script (thank you) on MacOS Monterey. When executing I get a lot of errors of type
chmod: Invalid file mode: 100444
chmod: Invalid file mode: 40755
chmod: Invalid file mode: 100666
(repeated many times and other number codes too)
The drivers appear to install
Installing components:
/Library/Application Support/National Instruments
/Library/Frameworks/Fantom.framework
/Library/Frameworks/VISA.framework
/Library/Preferences/NIvisa
Cleaning up
Done
But then the NXT2 is still not recognized by LEGO's EV3 software.
The MacOS still recognized the brick as a "Composite Device" same as before:
Composite Device:
Product ID: 0x0002
Vendor ID: 0x0694 (Lego Group)
Version: 0.00
Serial Number: 001653112B5A
Speed: Up to 12 Mb/s
Location ID: 0x14400000 / 53
Current Available (mA): 500
Current Required (mA): 0
Extra Operating Current (mA): 0