Saturday, August 22, 2015

Big trouble in Little OS X

Hi everyone!

Much to my excitement, a nearby school was selling off all of their old macbook to upgrade to new ones.  That means I scored myself a 2012 MacBook Pro with i5, 4G of ram, for less than $200.

How about I start playing around with my usual set of tools (Docker, Vagrant, etc..)... oh, but I remember hearing about a package manager.....  How to install Docker with Homebrew...

Homebrew! That's what it was!  I set myself up a non-admin user, use the admin user to install homebrew, give myself sudo privs, then I'm off to the races!  Ok, now I need to install Cask!  No big deal! I've got this nifty package manager and a command to install it!

Oh, what is this?  When I try to run the install command, I see the following...

bash-3.2$ brew install caskroom/cask/brew-cask
==> Tapping caskroom/cask
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Error: Failure while executing: git clone https://github.com/caskroom/homebrew-cask /usr/local/Library/Taps/caskroom/homebrew-cask --depth=1
bash-3.2$ git clone https://github.com/caskroom/homebrew-cask /usr/local/Library/Taps/caskroom/homebrew-cask --depth=1

xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.

It helpfully pops up a prompt to Get XCode or Install the XCode CLI tools... It pops up an aggrement, and then gets about 50% of the way though 'Downloading Software' and the time goes from 30min to 45min to 'About an Hour' and it just sits there until we see 'Failed due to network error'.  I'm assuming there is some hard-coded url in the xcode-select command that is no longer being served by apple.


Seeing similar issues to a post mentioned in this thread.

I noticed that the list of tools given at osxdaily is mostly present in my /usr/bin directory.  I created a softlink from /usr/bin to /Library/Developer/CommandLineTools/usr/bin, tried my brew install caskroom/cask/brew-cask call again, and nothing.... it just hangs.

OK... so I remove my softlink, and try following some other advise I had seen... to install all of XCode and use that to download the right CLI tools... I hop on over to the App Store and try to install it... I see 1 Update available, for Command Line Tools (OS X 10.9) 6.2.   I click update, wait a while, and it says 'installed' next to it.   I give my machine a reboot, try to do the brew install for cask again, and see the same problem!

So... I happened to see the command 'brew doctor'.  I ran that, and it said that I didn't have git installed, and that my /usr/local/bin was after /usr/bin on my path, which means the things brew installs will resolve after the system installed versions.

I simply created
bash-3.2$ cat ~/.bash_profile 

export PATH="/usr/local/bin:$PATH"
and did a 'brew install git'

That allowed me to get a little bit further... but I still hit an XCode CLI wall!

==> Installing brew-cask from caskroom/homebrew-cask
Error: The following formula:
  brew-cask
cannot be installed as a a binary package and must be built from source.
To continue, you must install Xcode from:
  https://developer.apple.com/downloads/
or the CLT by running:
  xcode-select --install


So... It looks like I'm stuck upgrading the OS!  

Even though I couldn't solve my actual problem, I hope some of my attempts at fixing my problem may be helpful for someone else!

Monday, August 3, 2015

TIL - paste!

Hi everyone!

Today, I was helping a co-worker with a script.  He needed to find some set of directories, add /*.jar to the end of each, and put them together in a single line as coma-separated values.

Enter paste!   (Funny thought, typing 'man paste' into google turned out much better than I thought it would!)

Say we had a list of all the files on my RaspberryPi's home directory, and we wanted to put them together as a comma separated list...   We would simply pipe them through paste with the --delimiters=, and --serial flags set.

$ ls ~/Desktop/ | paste -d, -s

debian-reference-common.desktop,idle3.desktop,idle.desktop,lxterminal.desktop,midori.desktop,ocr_resources.desktop,paste.out,pistore.desktop,python-games.desktop,scratch.desktop,shutdown.desktop,sonic-pi.desktop,wolfram-language.desktop,wolfram-mathematica.desktop,wpa_gui.desktop

Even though I've been using linux since about 2003, I feel like I stumble onto little nuggets like this pretty often!