How to Install Python3 on MAC OS X SIERRA

김영석
6 min readNov 1, 2019

The First Time Using Mac

This is awsome! To be honest, it is quite embarrassing but my first time to use MAC for anything. I have never experienced iOS or OS X before. Actually, I decided to buy this one because I felt dire need to invest some money on my job and my career after reading through various articles about getting mastery these days, so the first step to the mastery is getting new computer, new system.

For the last 10 years, I had been using only windows because I didn’t have any interest or understanding about Operating System, and how many OS even exists, but now I know I can’t wait and sit where I used to stay and just watch everyone gets faster and wiser than me.

As a Software Engineer, I will be using the most optimal system and user-friendly user experience for development and typical usages.

The First Mission for the First Usage

Some people believe that devices with high specs guarantee the high performance but it does not hold the truth to every case. To make it happen in reality, you’ve got to carry out some hands-on practices. Therefore, my first mission is to set up an environment for Django Web Development.

What’s needed?

what comes to my mind is as follows,

  1. Python installation — Python2, Python3? Mostly in need of python3.
  2. Pycharm installation — because I am used to developing in this IDE for Python programming.
  3. Git installation — for source version control, I have been using this so get it.
  4. SSH — When it comes to windows, I use Putty for SSH login but MAC? how things go? Particularly, I need to get an access to AWS EC2 instances.

The list above is just thought not clear yet. So, let’s clear then.

Problem 1 — Python Installation

Just out of curiosity, I just checked the version of python just in case. Surprisingly, it has a pre-built python 2.7 thankfully.

Python version 2.7.10

But the thing is I don’t really want to use Python 2.7.x series. I want something more brand-new! So, I am going to get Python 3!

Solution 1 — Install Python3

But here what I am concerned is how to effectively manage the versions of python between the pre-installed one and the new one. To solve this problem, I will use “pyenv” which is Python version manager.

Then, narrowing down that problem, I need to start from the basics like what kind of Software Package Manger I should use first in case of MAC. I am a PIP lover for python package installing and managing. But what am I going to use on MAC?

Pre-requisites — Package Manager for MAC!

MAC doesn’t provide a default package manager, I googled to find out that Homebrew package manager is well known, so let’s use it. Basically, MAC is one of UNIX-like operating systems but because it doesn’t provide full software tools it needs some help. and the help can be from Xcode Command Line Tools.

Step1. Xcode Command Line Tools

Apple gives small package of command line tools for software developers and at the same time, it offers Xcode application for software developers building applications. But Xcode applications itself is too huge, I am going to use only the small package of command line tools.

How to install Xcode Command Line Tools?It’s simple. Just open the terminal and type in Apple’s missing unix commands. like gcc

What is GCC? that is the abbreviation of GNU Compiler Collection. Simply speaking, it’s a collection of compiler supported by GNU( free-software project). Compilers are programming written in special language to turn things into machine-readable language so that computer processors can actually execute them.

Anyway, get down to it.

gcc command line in terminal
the gcc command prompts this pop up for command line tools installation.

Here I had to make a decision to install Xcode app or just the command line tools but I am not tolerant of any delay on my mission so I went for the command line tools only.

After agreement to the License
Starting to download the software
Successful installation of command line tools

Or the other way around here is this command.

xcode-select --install

if you use the command, it’s going to prompt up the same installation process, but here we have already installed so the error comes up saying “the command line tools are already installed”

Already Installed! be aware of that!

Before moving to the next step, one last final check on the installation!

xcode-select -p

This is exactly showing where the command line tools are installed.

Double Checked!

We are good to go!

Step2. Homebrew installation

Everything is in google. I found this command to install Homebrew.

Of course, I needed to understand what this command means at least,

meaning,

  • Use Ruby executable file
  • Use curl to get installer using https protocol from the URL
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

and the computer will take care of all things behind the scenes.

It explains what’s going to be created and ask for the confirmation.
Once approved, installation have been finished within a couple of minutes.

Step3. Pyenv Installation

Before I actually installed Pyenv, I wanted to make sure what I am doing.

It started up by understanding what features Pyenv can support.

It helps using multiple version of python by switching over on user-base and project-base.

So, I installed pyenv.

Installation under process
Version Check
Python versions list for installation

For better usage of Pyenv, I needed to know how things work . Pretty much details are found in this link — https://github.com/pyenv/pyenv

Now, assuming that I have understood all the details about how Pyenv works under the hood, I proceeded.

Then install the python version that you specify as below

execute “pyenv install -v <the-version-you-specify>”

After the installation is completed, you can list the installed version in the following directory.

and then you can set the default version by executing a command

then test it. Finish!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

김영석
김영석

Written by 김영석

I love problem solving and hate repetition of tedious tasks. I like automating, streamlining, optimizing, things.

No responses yet

Write a response