11

I recently moved to using OSX to administrate my linux box, so I'm very new to using linux programs on OSX.

I want to use Vagrant with Ansible to bootstrap my development environment, so I need to install it first.

However I've discovered two ways to install Ansible on OSX:

Pip: http://devopsu.com/guides/ansible-mac-osx.html

Homebrew: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ansible.rb

I have already installed Ansible with the pip method, since I came across that guide first.

What are the pros and cons with both methods? Should I install Ansible using pip or homebrew?

I have found that easy install interferes with homebrew:

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    easy_install
    easy_install-2.7
Hyperfocus
  • 1,177
  • 4
  • 14
  • 23
  • Personally, I just installed it straight from the Git repository. http://ansibleworks.com/docs/intro_installation.html#running-from-source – ceejayoz Dec 18 '13 at 21:09
  • 1
    [*administer* or *administrate*?](http://english.stackexchange.com/questions/14556/is-administrate-a-valid-english-verb-whats-the-difference-between-it-and-ad) - Either Pip or Homebrew work. Just stuck with one. – ewwhite Dec 18 '13 at 22:21

2 Answers2

8

I've never had any trouble with Homebrew. In my opinion, it's the best package manager type tool for Mac OS X out there right now (but perhaps not as complete as MacPorts.)
Here's a useful guide for installing Homebrew on Mac OS X Mavericks.
Then simply run

brew install ansible  
race_carr
  • 201
  • 1
  • 4
  • 1
    I like having this installed system wide using Homebrew b/c it's *always* available regardless of what virtual environment I have activated. This might not matter if you share site-packages in your virtual environments, but I'd prefer not to do that. – bennylope Apr 17 '14 at 18:49
7

I think you will find it best to install it via pip

from the documentation;

Latest Releases Via Pip

Ansible can be installed via “pip”, the Python package manager. If ‘pip’ isn’t already available in your version of Python, you can get pip by:

$ sudo easy_install pip

Then install Ansible with:

$ sudo pip install ansible

Readers that use virtualenv can also install Ansible under virtualenv, though we’d recommend to not worry about it and just install Ansible globally. Do not use easy_install to install ansible directly.

This will allow you to update easily, as it gets the latest version well before brew does.

Kevin
  • 633
  • 3
  • 7
  • virtualenv can isolate a separate python with Ansible and all its dependencies into one directory, here called 'MyAnsible'. That guarantees indepencence from the system python and libraries installed there. Once you start working on several python projects you will appreciate this. Here's howto install virtualenv: *on Mac:* sudo easy_install virtualenv==1.10.1 *on RedHat:* sudo yum install -y python-virtualenv *Here is how to setup ansible with virtualenv:* virtualenv MyAnsible MyAnsible/bin/pip install ansible virtualenv --relocatable MyAnsible – bbaassssiiee Jan 29 '14 at 08:28
  • Fair enough. That quote is just from the official documentation, where they suggest to install globally. – Kevin Jan 31 '14 at 06:23
  • 1
    "brew update && brew upgrade ansible"is breaking ansible right now. we should stick with pip – Alexander Jardim Jun 22 '15 at 12:43