
PROTIP: There may be several Python executables installed in different folders. You are good to go with Pipenv if you see in the first response to the type -a python command (but instead of “wilson_mar”, you’ll see your own user name): python3 is /Users/wilson_mar/.pyenv/shims/python3 Python3 is is /usr/local/anaconda3/bin/python Python is /Users/wilson_mar/anaconda3/bin/python

#GITHUB MAC OS INSTALL#
So Homebrew and other installers install to the User-owned /usr/local/ which does NOT require sudo to access.ĭifferent installers install Python in different paths (but instead of “wilson_mar”, you’ll see your own user name): python is /Users/wilson_mar/.pyenv/shims/python PROTIP: The /usr/bin/ folder is owned by the operating system, so elevated sudo priviledges are required to modify files in it (such as “python”). Get a list of the various locations where Python is installed (by various installers): type -a pythonĪ new macOS version would show: python is /usr/bin/python PROTIP: Before installing things, first see what is already installed. The alternative to Pyenv is Conda and MiniConda. Thus, which aws would return: /Users/wilson_mar/.pyenv/shims/aws Competitors This technique is possible because the operating system searches for executables in folders in the PATH from left to right. That’s achieved by a line at the bottom of your ~/.bash_profile which makes the operating system search in the shims folder for programs: export PATH="$PYENV_ROOT/shims:$PATH"

Pyenv uses a technique called “rehashing” so it can switch among multiple versions of Python2 or Python3.Ĭommands for the operating system to execute “python3” are intercepted by a shim executable which passes commands along to the actual Python installation of the desired version. Why? Because I haven’t seen one on the internet. Here is a hands-on “deep dive” tutorial so you better grasp the complexities in a shorter time. In this article I take a carefully crafted narrated tour. Switch between installed versions without resetting your bash session.

#GITHUB MAC OS HOW TO#
More info on how to download Command Line Tools inside XCode can be found on StackOverflow 3. Whole Xcode but might not work for all cases tho - or you can run xcode-select -install "Command Line Tools" can be downloaded separate from Xcode at NOTE: homebrew now automatically installs command line tools, so you can skip this step. Install Xcode and/or "Command Line Tools" * I'm by no means an OSX/ nix expert, use with care. This gist is just a personal reference in case I need to do it all over again. (or anything similar) to automate the process, but TBH I only actually needed to I kinda regret for not using something like Boxen Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've I've done the same process every couple years since 2013 (Mountain
