"xcode-select --install" being background


(walkerdan1) #1

Hi Community,

I’ve been trying to solve this issue for the better part of the day and can’t find anything on the net as a hint or remedy.

Problem:

Trying to install xcode command line tools ONLY on Sierra via my installer bash script, but the [xcode-select --install] command that’s defined in my bash script, is backgrounded, so other parts of my script are being executed prematurely. Has anyone ever experienced this and if so, what was your workaround.

FYI: The below code is installing [xcode] then [brew, python, pyside, etc…] and it’s being done this way over using the default method [/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”] because in the Installer I’ve created with AppleScript, I’m executing the bash script with admin privilages, which the default method of installing brew, chokes on.

Here’s an excerpt of what the bash script looks like:

!#/bin/bash

xcode-select --install

cd /usr/local

/usr/bin/curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1

/usr/local/bin/brew install python
/usr/local/bin/brew tap cartr/qt4
/usr/local/bin/brew tap-pin cartr/qt4
/usr/local/bin/brew install cartr/qt4/qt@4
/usr/local/bin/brew install cmake
/usr/local/bin/pip install wheel requests PySide

Apologies for sounding like I’m rambling. Sleep deprivation will do that to ya!

Thanks in advance,
Dan


(loyaltyarm) #2

Hey Dan,

Brew automatically installs the Xcode CLI tools if they are missing now (since 1.0 I believe), so you should focus on getting the privileged brew installation executed as your logged in user, which sounds like is a goal from your post. You can try the command below to do that.

sudo -u $USER /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \ </dev/null

Other recommendations I would make are to run all your taps before you attempt to install various brew formulae, but that is mostly semantic.

Hope that helps!


(Alex b) #3

Hey!

I’ve started using homebrew for setting up my MacBook and I noticed that the Xcode command runs in the setup and that is awesome. There is an issue however, that most online tutorials for installing home-brew tell you to install Xcode and/or it’s CLI’s first. It seems to me to be a waste of time now that it is done by homebrew and incredibly convenient. Could we in some way alert people to this feature now?


(Jacob Ledbetter) #4

It is up to them to do the research. If you know the person making the video or presentation tell them that brew has a limited Xcode installed.