Should I install Ansible with python pip or homebrew on Mac OSX Mavericks?

16,012

Solution 1

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  

Solution 2

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.

Share:
16,012

Related videos on Youtube

Hyperfocus
Author by

Hyperfocus

My first StackOverflow account

Updated on September 18, 2022

Comments

  • Hyperfocus
    Hyperfocus over 1 year

    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
    
  • bbaassssiiee
    bbaassssiiee over 10 years
    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
  • Kevin
    Kevin over 10 years
    Fair enough. That quote is just from the official documentation, where they suggest to install globally.
  • user1927602
    user1927602 about 10 years
    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.
  • Alexander Jardim
    Alexander Jardim almost 9 years
    "brew update && brew upgrade ansible"is breaking ansible right now. we should stick with pip