The Homebrew package manager may be used on Linux and Windows Subsystem for Linux (WSL). Homebrew was formerly referred to as Linuxbrew when running on Linux or WSL. It can be installed in your home directory, in which case it does not use sudo. Homebrew does not use any libraries provided by your host system, except glibc and gcc if they are new enough. Homebrew can install its own current versions of glibc and gcc for older distributions of Linux.
Features, installation instructions and requirements are described below. Terminology (e.g. the difference between a Cellar, Tap, Cask and so forth) is explained in the documentation.
Homebrew is a package manager designed for Mac that is useful to install. You will find that you can utilize Homebrew for data science as it makes it a lot easier to install additional technologies on Mac such as Apache Spark and the software Graphviz. With that, let’s get started. Install Command Line Tools. A brew upgrade upgraded my system Python to Python 3.7. Unfortunately, Python 3.7 breaks other software I need to use (including but not limited to Ansible). I imagine these problems will be worked.
Features
- Can install software to your home directory and so does not require sudo
- Install software not packaged by your host distribution
- Install up-to-date versions of software when your host distribution is old
- Use the same package manager to manage your macOS, Linux, and Windows systems
Install
# Update configuration source.bashprofile # Verification brew update pip install -upgrade pip 2. How to Change Sources for brew Correctly. Setting up a global proxy or switching sources has their own advantages and disadvantages. If you want to switch sources, try the following steps. A command-line package installer is a handy tool that installs your desired software package without a fancy UI, yet it often proves to be more effective than some tools integrated into expensive IDEs. Brew and Pip are two of the more popular options for package installers when.
Instructions for a supported install of Homebrew on Linux are on the homepage.
The installation script installs Homebrew to /home/linuxbrew/.linuxbrew
using sudo if possible and in your home directory at ~/.linuxbrew
otherwise. Homebrew does not use sudo after installation. Using /home/linuxbrew/.linuxbrew
allows the use of more binary packages (bottles) than installing in your personal home directory.
The prefix /home/linuxbrew/.linuxbrew
was chosen so that users without admin access can ask an admin to create a linuxbrew
role account and still benefit from precompiled binaries. If you do not yourself have admin privileges, consider asking your admin staff to create a linuxbrew
role account for you with home directory /home/linuxbrew
.
Follow the Next steps instructions to add Homebrew to your PATH
and to your bash shell profile script, either ~/.profile
on Debian/Ubuntu or ~/.bash_profile
on CentOS/Fedora/Red Hat.
You’re done! Try installing a package:
If you’re using an older distribution of Linux, installing your first package will also install a recent version of glibc and gcc. Use brew doctor
to troubleshoot common issues.
Requirements
- GCC 4.7.0 or newer
- Linux 2.6.32 or newer
- Glibc 2.13 or newer
- 64-bit x86_64 CPU
Paste at a terminal prompt:
Debian or Ubuntu
Fedora, CentOS, or Red Hat
ARM
Homebrew can run on 32-bit ARM (Raspberry Pi and others) and 64-bit ARM (AArch64), but no binary packages (bottles) are available. Support for ARM is on a best-effort basis. Pull requests are welcome to improve the experience on ARM platforms.
You may need to install your own Ruby using your system package manager, a PPA, or rbenv/ruby-build
as we no longer distribute a Homebrew Portable Ruby for ARM.
32-bit x86
Homebrew does not currently support 32-bit x86 platforms. It would be possible for Homebrew to work on 32-bit x86 platforms with some effort. An interested and dedicated person could maintain a fork of Homebrew to develop support for 32-bit x86.
Alternative Installation
Extract or git clone
Homebrew wherever you want. Use /home/linuxbrew/.linuxbrew
if possible (to enable the use of binary packages).
Homebrew on Linux Community
Note
Check out our guide for installing Python 3 on OS X.
Mac OS X comes with Python 2.7 out of the box.
You do not need to install or configure anything else to use Python. Having saidthat, I would strongly recommend that you install the tools and librariesdescribed in the next section before you start building Python applications forreal-world use. In particular, you should always install Setuptools, as it makesit much easier for you to install and manage other third-party Python libraries.
The version of Python that ships with OS X is great for learning, but it’s notgood for development. The version shipped with OS X may be out of date from theofficial current Python release,which is considered the stable production version.
Doing it Right¶
Let’s install a real version of Python.
Before installing Python, you’ll need to install a C compiler. The fastest wayis to install the Xcode Command Line Tools by runningxcode-select--install
. You can also download the full version ofXcode from the Mac App Store, or theminimal but unofficialOSX-GCC-Installerpackage.
Note
If you already have Xcode installed, do not install OSX-GCC-Installer.In combination, the software can cause issues that are difficult todiagnose.
Note
If you perform a fresh install of Xcode, you will also need to add thecommandline tools by running xcode-select--install
on the terminal.
While OS X comes with a large number of Unix utilities, those familiar withLinux systems will notice one key component missing: a decent package manager.Homebrew fills this void.
To install Homebrew, open Terminal
oryour favorite OS X terminal emulator and run
The script will explain what changes it will make and prompt you before theinstallation begins.Once you’ve installed Homebrew, insert the Homebrew directory at the topof your PATH
environment variable. You can do this by adding the followingline at the bottom of your ~/.profile
file
Now, we can install Python 2.7:
Homebrew Piper
Because python@2
is a “keg”, we need to update our PATH
again, to point at our new installation:
Homebrew names the executable python2
so that you can still run the system Python via the executable python
.
Setuptools & Pip¶
Homebrew installs Setuptools and pip
for you.
Setuptools enables you to download and install any compliant Pythonsoftware over a network (usually the Internet) with a single command(easy_install
). It also enables you to add this network installationcapability to your own Python software with very little work.
pip
is a tool for easily installing and managing Python packages,that is recommended over easy_install
. It is superior to easy_install
in several ways,and is actively maintained.
Virtual Environments¶
A Virtual Environment (commonly referred to as a ‘virtualenv’) is a tool to keep the dependencies required by different projectsin separate places, by creating virtual Python environments for them. It solves the“Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keepsyour global site-packages directory clean and manageable.
For example, you can work on a project which requires Django 1.10 while alsomaintaining a project which requires Django 1.8.
To start using this and see more information: Virtual Environments docs.
Install Pip With Brew
This page is a remixed version of another guide,which is available under the same license.