Programming, Technology, Uncategorized

Installing Ansible on a fresh Mavericks system.

I recently purchased a new Retina Macbook Pro, and was surprised that Ansible did not install as easily as it did before. Looking back through the output on the CLI we see it is trying to use Apples CLANG. Which unfortunately has some deprecated stuff. I guess i had already installed the correct GCC etc manually on my older machines.

No worries though, this is the simplest way i have found to power through this.

Firstly, install apples developer tools. Likely you will just download XCode through the App Store. Then once you have opened it at least once to agree to the terms and conditions, you will also need to go to the xcode preferences and ‘Locations’ tab, to select the latest ‘Command Line Tools’ version. Then you will need to run this on the command line.

xcode-select --install

This will install some additional command line tools which you will need. It will open a GUI prompt to install them, so just go ahead with that.

With XCode installed we can now install Homebrew, a package manager for mac, which will make installing the non Apple version of GCC much easier. To install Homebrew, run the following on the CLI.

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

Then run this, which will tell us if Homebrew is working correctly, or if there are any issues.

brew doctor

Now we must install the correct GCC via Homebrew.

brew tap homebrew/dupes
brew install apple-gcc42

With that now installed, we must move Apples GCC aside so that we can use the correct one.

cd /usr/bin
sudo mv gcc gcc_mavs
sudo mv cc cc_mavs
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 gcc
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 cc

Then, we are good to go ahead and run the steps on Ansibles installation page found here

Problems that were occurring previously with CLANG and the like should now be gone.

Credit where credit is due, these 2 sites documented the steps i followed:
[1] Installing Homebrew on OS X Mavericks 10.9, Package Manager for Unix Apps
[2] Paul Crawford : Installing gcc on Mavericks