Setting up macOS to enable API&Python related Stuff – the BREW way

Most people will either use:

  • Windows (you’re on your own buddy!)
  • Linux (you probably already have everything you need installed already!)
  • macOS (you’ve got a Terminal but all programs are old….)

So if you are using a macOS you kinda have a Terminal running Bash (for now) by default but all programs are horribly old and wont get you far!

There are gazillions of different paths you can take to get decent python and pip Versions and Updated Versions of other tools running!

Homebrew

I will describe just one of them: the BREW way. Taken from the Documentation:

Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with macOS.

The good thing: Homebrew will just conveniently install up to date UNIX tools beside the default apple built in tools without touching or removing them! So you can keep the default BASH and python from macOS but also install recent versions beside them in your profile and use them whenever you feel like it!

If you are familiar with brew chances are you already have it installed on your macOS! If not don not just blindly pull install scripts from the Internet and hope they wont own you!

Read up a bit! Ask Professionals with Macs if they use brew and if the trust it! Do some research about what you are going to do!

If you can and have the time you might even want to dig through the brew Installer Script before installing it!

If you are paranoid: download the brew installer script manually from the github repository before feeding it to ruby! Make sure its the same as in github before Installing it to verify it has not been tempered with during download!

After you have installed homebrew you will use two commands often:

brew update

…to update your installed brew packages…

brew install PACKAGE

…to install a new UNIX tool.

Note: Homebrew will not replace the default macOS programs in your path! So if you for example installed Bash v4.x via Homebrew macOS will not launch Bash v4.x when you launch a terminal!

But you can always spawn a Bash v4.x instance by calling it from its installation directory:

/usr/local/bin/bash

Install bash & python & pip & pyTenable

Install Bash

First of I would recommend to install a recent Version of Bash to be able to run all bash scripts you encounter (there are scripts that will not work with macOS old Version of bash!

brew install bash

Note: Remember as stated above that you have to drop into this new Version of Bash 4.x by calling it directly:

/usr/local/bin/bash

Install Python, pip & pyTenable API Wrapper

When you have successfully installed Homebrew and played around with updating it and all installed packages you can continue installing python and the pyTenable API Wrapper:

brew install python

will install python (Version 2 and 3 including pip for both versions).

pip3 install pyTenable

will install the pyTenable API Wrapper.

Note: As there is no pip3 command on macOS by default the pip3 installer will automatically be in your path and no dedicated calling form /usr/local/bin is required.

 

Thats it!

You are now able to use recent versions of Bash4, python2, python3, pip2, pip3 and pyTenable!

About SebastianB

read it in my blog
This entry was posted in tenable and tagged , , , , , . Bookmark the permalink.