How to Setup Mac for Machine Learning – Homebrew, Anaconda, Python, wget, Tmux

In Machine Learning by enterprise1 Comment

When you are planning to start working on the Macbook for your Machine Learning or Deep Learning Related Tasks, it will not have all the tools and libraries. Below are various steps to setup each of these for you to be able to do Machine Learning or Deep Learning using Python.

First step on MacBook when you get it new is to install Homebrew. First you need to open the Terminal on Mac. It is just like Command Line in Windows, in case you are new to MacOS.

Use iTerm 2 , instead of default terminal, it is great. You can instal iTerm 2 by downloading it from  https://www.iterm2.com/  , you just need to download and move that file to Applications, so that becomes a standard app.

How to Install Homebrew ?

Homebrew is a package manager for MacOS and lets you install any missing packages easily.

You install Homebrew by below command by pasting in Terminal . If you get any prompts, just say yes, it will install respective packages and CLI tools.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

You can go to website https://brew.sh/ to get the latest info

How to install wget ?

wget is a very commonly used command and it is not available by default on Mac. You can install wget using HomeBrew by using below command in Terminal.

brew install wget --with-libressl

How to install Anaconda – Python Distribution on Mac using Terminal ?

Anaconda is a famous python distribution for Machine Learning or Deep learning. You can setup using terminal as below. We are installing 3.6 version directly using CLI .  Anaconda Distributions are at https://repo.continuum.io/archive/ . Go to terminal and type

wget https://repo.continuum.io/archive/Anaconda3-5.0.1-MacOSX-x86_64.sh

it is about 500 MB and can take a minute or two. Next you type the below command to install.

bash Anaconda3-5.0.1-MacOSX-x86_64.sh

It will take 5 to 7 min to install this. It will ask for few prompts, just say Yes or hit enter for everything, so that it takes default settings.

To make sure the installation is applied to your terminal, I suggest you quit the terminal and then re-lauch the terminal. You can verify if it is the right version installed by using the below command

python --version  or you can also type  command  conda to see if Anaconda is installed

Setting up tmux for better management of terminals

tmux is a terminal multiplexer. it is great, when you are working with remote terminals, especially in Machine Learning world you will have AWS GPUs or Google’s etc. This will help you mange the sessions well and have it running in background. More details at https://github.com/tmux/tmux/wiki . You can use the below command to install tmux

brew install tmux

Now, you can type tmux command on terminal, you should see a normal window.  You can see TMUX Info here : http://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/


Comments ( 1 )

  1. Pingback: How to install Atom on Mac ?

Leave a Comment

Comments Policy :
  • Comments are to drive conversation, add your thoughts, experiences, ask questions!
  • Do NOT write hate speech, swear words, or get into fight. Maintain etiquette
  • Enter your Name, valid Email, URL(optional - Facebook, LinkedIn profile URLs).
  • Your email will NOT be published. Do NOT post any phone numbers, email-ids
  • Do NOT post any links from other websites, unless official sites, University websites.
  • By submitting your comment, you agree to Term and Conditions of our website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.