Skip to content

Commit

Permalink
Update configure-machine-for-blogging to wait until "xcode-select --i…
Browse files Browse the repository at this point in the history
…nstall" completes

"xcode-select --install" launches /System/Library/CoreServices/Install Command Line Developer Tools.app/Contents/MacOS/Install Command Line Developer Tools
to do the actual installation. Wait until this process exits before continuing execution
of the script to ensure that the CLI tools are installed. I assume that process exits
indicates success.
  • Loading branch information
dydz committed Jan 2, 2022
1 parent e368be2 commit 01c39fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions configure-machine-for-blogging
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ hasDirectoryInPathEnvironmentVariable()

# Ensure Ruby and other developer command line tools are installed.
echo "Running xcode-select --install..." >&2

# Will spawn /System/Library/CoreServices/Install Command Line Developer Tools.app/Contents/MacOS/Install Command Line Developer Tools
xcode-select --install >/dev/null 2>&1 || true
toolsInstallerPID=$(pgrep 'Install Command Line Developer Tools') || true
if [ -n "$toolsInstallerPID" ]; then
# Assume that when the installer exits that installation was successfull.
lsof -p "$toolsInstallerPID" +r 1 >/dev/null 2>&1
fi

if ! which ruby >/dev/null 2>&1; then
echo "Couldn't find ruby. Is it installed?" >&2
Expand Down

0 comments on commit 01c39fd

Please sign in to comment.