How to install pip, brew, python3 and ansible on macOS Big Sur 2021

August 30, 2021 | By | Reply More

[et_pb_section admin_label=”section”]
[et_pb_row admin_label=”row”]
[et_pb_column type=”4_4″][et_pb_text admin_label=”Text”]

On Mac OS, Python itself is capable of installing pip, no external commands or even internet required. However, Mac OS comes with python so there’s a chance pip is already installed on your machine.

To verify pip is installed properly run

pip --version

To upgrade pip

pip install --upgrade pip

See what’s installed

pip freeze

Uninstall a package

pip uninstall <package>

Homebrew

Homebrew needs Command Line Tools for Xcode installed. So first install Xcode from App Store or from terminal using this command,

sudo xcode-select --install

To install Brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Setting up your PATH

echo 'PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

Verify brew installation

brew doctor

It should retrun

Your system is ready to brew.

To install Python using HomeBrew:

Python 3 is the default version when installing with Homebrew.

Installing a separate copy of Python is another option. Main benefits are having the latest Python release and some protection from hosing your system if things go badly wrong.

brew update
brew install python # or brew install python3
brew install python3 # this only installs python
brew postinstall python3 # this installs pip

For those who have python3 already installed as second copy, install pip using these commands

wget https://bootstrap.pypa.io/get-pip.py
sudo python3.6 get-pip.py

Install ansible using brew,

brew install ansible

Check version of installed ansible

ansible --version

[/et_pb_text][/et_pb_column]
[/et_pb_row]
[/et_pb_section]

Category: Cloud

Leave a Reply