macOS setup for data science
Here, I summarise how I setup my macOS for the purpose of Data Science. Ultimately, I should invest some time into automating the process.
Install Command Line Developer Tools
xcode-select --install
Install HomeBrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Turn off analytic (optional)
brew analytics off
Install iTerm
brew install iterm
Configure iTerm
To download different colour schemes, visit iTerm Themes
Install Go2Sehll
Download and install from Go2Shell, then configure it to work with iTerm:
Install git
brew install git
Configure git
git config --global user.name "userName"
git config --global user.email "email@mailprovider.com"
git config --global core.excludesfile '~/.gitignore'
Configure ssh key
mkdir ~/.ssh #if it does not already exist
chmod 700 ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa -C "email@mailprovider.com"
enter a keyname
enter a passphrase
cat ~/.ssh/keyname.pub
Copy the key to GitHub. Go to GitHub Settings. From the left margin, choose SSH and GPG keys
and click on New SSH key
. Paste the value copied above and give the key a name.
eval `ssh-agent -s` # if needed
ssh-add ~/.ssh/KEYNAME
Install zsh
brew install zsh
echo "$(which zsh)"
sudo vi /etc/shells
Edit /etc/shells/
and add the path /usr/local/bin/zsh
at the end of the file.
chsh -s $(which zsh)
Install prezto
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
Configure prezto
Create soft links ln -s
to all the files found in ~/.zprezto/runcoms/
and change each link’s NAME to .NAME:
cd ~
ln -s .zprezto/runcoms/z* .
mv zlogin .zlogin
mv zlogout .zlogout
mv zpreztorc .zpreztorc
mv zprofile .zprofile
mv zshenv .zshenv
mv zshrc .zshrc
Prezto has many useful modules and here is a list of all modules available. You can edit .zpreztorc
to enable any of them:
# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'history' \
'directory' \
'spectrum' \
'utility' \
'completion' \
'git' \
'archive' \
'osx' \
'python' \
'ruby' \
'fasd' \
'autosuggestions' \
'command-not-found' \
'dnf' \
'dpkg' \
'emacs' \
'gnu-utility' \
'gpg' \
'haskell' \
'helper' \
'homebrew' \
'macports' \
'node' \
'ocaml' \
'pacman' \
'perl' \
'rails' \
'rsync' \
'screen' \
'ssh' \
'tmux' \
'wakeonlan' \
'yum' \
'syntax-highlighting' \
'history-substring-search' \
'prompt'
Install Sublime Text
brew cask install sublime-text
Configure Sublime Text
sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
And then install Package Control
to enable various useful packages.
Now, using the keyboard shortcut Cmd + Shift + p
to invoke the Command Palette
.
Type Install Package
and hit enter, then type the name of the package to be installed. Visit Package Control website to search for useful packages.
Install R
brew tap homebrew/science
brew install openblas
brew install r --with-openblas
Install RStudio (Preview version)
brew install Caskroom/cask/rstudio-preview
Hints
Open finder from terminal
open .
Show/hide hidden files
defaults write com.apple.finder AppleShowAllFiles YES # to show hidden files
defaults write com.apple.finder AppleShowAllFiles NO # to hide hidden files
Then, press alt
while clicking on Finder icon to Relunch
Finder.