As part of my build process I’m trying to mount a DMG using hdiutil.
I’ve written a shell script to do this, and because hdiutil asks for confirmation of the license agreement before opening, I have in my script something like yes | hdiutil .... When I run the script from a bash shell like Terminal.app there are no problems and the process works as expected.
However, when I add an ‘external build system’ target to Xcode and have /bin/bash run my script, it hangs forever after executing the hdiutil command.
I’m guessing that yes is not terminating; what would cause this to behave differently when the script is invoked by a GUI app as opposed to an interactive bash shell and how can I make it work using both approaches?
I needed to use
echo y | hdiutilisntead ofyes | hdiutilas suggested by @trojanfoe.