How to install Jupyter Notebook on Mac using Homebrew
This tutorial explains how to install, run, and use Jupyter Notebooks on MAC.
What Is A Jupyter Notebook?
In this case, “notebook” or “notebook documents” denote documents that contain both code and rich text elements, such as figures, links, equations, … Because of the mix of code and text elements, these documents are the ideal place to bring together an analysis description, and its results, as well as, they can be executed perform the data analysis in real time.
The Jupyter Notebook App produces these documents.
For now, you should know that “Jupyter” is a loose acronym meaning Julia, Python, and R. These programming languages were the first target languages of the Jupyter application, but nowadays, the notebook technology also supports many other languages
The steps below shows how to install Jupyter:
Step 0 — Install Homebrew
The simplest way to install various Unix tools and open source projects onto Mac is via a package manager. Unfortunately, Mac doesn’t offer one by default so we’ll use Homebrew
xCode command line tools:
Install Mac OS X command line tools so that you can then install the Homebrew package manager.
Open up Terminal and type:
xcode-select --install
Double Check your work
If you see terminal respond back with a path to “CommandLineTools”, then you’re good to go.
xcode-select -p
Install Homebrew
Please paste this into Terminal.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step 1 — Install pyenv
Mac Os X come with Pythong 2.7 pre-installed but many Machine Learning packages are progressing to Python 3.x. Therefore, it’s recommended you start using Python 3 and the best way to do that is to first install pyenv
version manager. This will allow you to install any version of Python you'd like.
First update Homebrew package manager.
brew update && brew doctor
Install pyenv
version manager.
brew install pyenv
Step 2 — Install Python
Install Python 3.x using pyenv
. You can see a list of version from Python Website.
pyenv install -l | grep -ow [0-9].[0-9].[0-9]
pyenv install 3.x.x
Double check your work.
pyenv versions
You’ll also need to configure your ~/.bash_profile
.
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
Step 3 — Set Python to Local or Global
If you only want to use Python 3.x for a specific project, then cd
to your specific directory and type:
pyenv local 3.x.x
If you’d prefer to just have Python 3.x installed globally throughout your operating system, then type:
pyenv global 3.x.x
Step 4 — Install Jupyter
Jupyter is an acronym for Julia, Python and R but these days, other languages are also included such as Ruby.
brew install jupyter
Step 5 — Start Jupyter
Now it’s time to start the jupyter notebook.
jupyter notebook