osx - Verify Xcode Command Line Tools Install in Bash Script -


i creating bash script setup development environment. part of script need install xcode command line tools , don't want script continue execution until installation has been completed.

when run:

xcode-select --install 

it prints install has been requested or has been installed. want able wait until message changes being installed.

the relevant part of script follows:

check="$(xcode-\select --install)" echo "$check" str="xcode-select: note: install requested command line developer tools\n" while [[ "$check" == "$str" ]];     check="$(xcode-\select --install)"     sleep 1 done 

unfortunately $check empty because xcode-select --install not return , instead echoes message terminal.

i know have solved issue, had crack @ problem today, , discovered prints stderr , not stdout. code used determine whether xcode installed or not:

check=$((xcode-\select --install) 2>&1) echo $check str="xcode-select: note: install requested command line developer tools" while [[ "$check" == "$str" ]];   osascript -e 'tell app "system events" display dialog "xcode command-line tools missing." buttons "ok" default button 1 title "xcode command-line tools"'   exit;   done 

hope helps in future :)


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -