I need to make a bash script that, in case of an error, will restart the installation of command line tools, and in case the user cancels the installation, then stop the script. I thought to parse the error code but I can’t get it as xcode-select starts ‘Install Command Line Developer Tools.app’ as a child process. I cannot run ‘Install Command Line Developer Tools.app’ due next error
Install Command Line Developer Tools[68192:4620947] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) ‘Permission denied’, port = 0x9107, name=”com.apple.dt.CommandLineTools.installondemand”
See /usr/include/servers/bootstrap_defs.h for the error codes.
What else can I try ?
My current script is:
pid=$(ps -ef | grep "Install Command Line Developer Tools" | grep -v grep | awk '{print $2}' | xargs -r)
until [[ -z $pid ]]; do
sleep 5;
pid=$(ps -ef | grep "Install Command Line Developer Tools" | grep -v grep | awk '{print $2}' | xargs -r)
done
if [[ ! -e "/Library/Developer/CommandLineTools/usr/bin/git" ]] ; then
echo "Error: User canceled xcode command line tools installation or xcode command line tools installation failed."
fi