Wed, Oct 20, 21, initial setup on mac machine

Thi

This is my personal list of to-do things for a new Macbook.

👉 Note: Mac fresh start.

Install

# Install XCode (from Appstore)

# Install XCode Command Line Tolls
xcode-select --install

# Download & install miniforge3
# https://github.com/conda-forge/miniforge
# (Choose "MacOSX-arm64" version)

chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate

# Restart terminal and check
which python
# /Users/thi/miniforge3/bin/python
which pip
# /Users/thi/miniforge3/bin/pip
# Init conda with zsh?
conda init zsh
source ~/.zshrc
# Create virtual env
conda create -n ds-tf2.5 python=3.9.5
conda activate ds-tf2.5

# Install Tensorflow dependencies
conda install -c apple tensorflow-deps

# Install base tensorflow
python -m pip install tensorflow-macos

# Install metal plugin
python -m pip install tensorflow-metal
# Install needed packages
conda install --file requirements.txt

# single package
conda install -y scikit-learn
# check after installing
pip show scikit-learn

👉🏻 Install scikit-learn on M1 (official note). 👉🏻 Note: Python installation.

Testing

python

# In python environement
import tensorflow as tf
print(tf.__version__)
# Jupyter Notebook
jupyter lab

The missing package manager for macOS (or Linux).

Wiki | brew

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

The script explains what it will do and then pauses before it does it. Read about other installation options. Install Homebrew on Linux and Windows Subsystem for Linux.

from curious programmer

Java OpenJDK

OpenJDK is a free and open-source implementation of the Java SE Platform Edition.

Wiki | GitHub | StackExchange

brew tap AdoptOpenJDK/openjdk
brew install <version>

Versions:

  • adoptopenjdk-openjdk8
  • adoptopenjdk-openjdk9
  • adoptopenjdk-openjdk10

Clojure

Clojure is a modern, dynamic, and functional dialect of the Lisp programming language on the Java platform. Like other Lisps, Clojure treats code as data and has a Lisp macro system. The current development process is community-driven, overseen by Rich Hickey as its benevolent dictator for life.

Wiki | Clojure.org

brew install clojure

Leiningen

Leiningen is a build automation and dependency management tool for the simple configuration of software projects written in the Clojure programming language. Leiningen was created by Phil Hagelberg.

Wiki | GitHub | Homebrew

brew install leiningen

Node

Node.js is an open-source, cross-platform, JavaScript run-time environment that executes JavaScript code outside of a browser.

Wiki | NodeSource | NodeJS

sudo npm install npm --global # Update the `npm` CLI client

shell

iTerm2

iTerm2 is a GPL-licensed terminal emulator for macOS. It was derived from and has mostly supplanted the earlier “iTerm” application. iTerm2 supports operating system features such as window transparency, full-screen mode, Exposé Tabs, Growl notifications, and standard keyboard shortcuts.

Wiki | iTerm2

Zsh

The Z shell (zsh) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.

Wiki | Zsh | Installation

Try zsh --version before installing it from Homebrew. If it’s newer than 4.3.9 you might be OK. Preferably newer than or equal to 5.0.

brew install zsh zsh-completions

To set zsh as your default shell, execute the following for macOS High Sierra

chsh -s /bin/zsh

Assuming you have Homebrew installed. If not, most versions of macOS ship zsh by default, but it’s normally an older version. Alternatively, you may also use MacPorts

sudo port install zsh zsh-completions

oh-my-zsh

Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.

Ohmyz | GitHub

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Powerlevel9k

Powerlevel9k is a theme for ZSH which uses Powerline Fonts. It can be used with vanilla ZSH or ZSH frameworks such as Oh-My-Zsh, Prezto, Antigen, and many others. Get more out of your terminal. Be a badass.

GitHub

brew tap sambadevi/powerlevel9k
brew install powerlevel9k
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
ZSH_THEME="powerlevel9k/powerlevel9k" #update ~/.zshrc file

zsh-syntax-highlighting

This package provides syntax highlighting for the shell zsh. It enables highlighting of commands whilst they are typed at a zsh prompt into an interactive terminal. This helps in reviewing commands before running them, particularly in catching syntax errors.

GitHub

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

zsh-autosuggestion

It suggests commands as you type based on history and completions.

GitHub

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Activate plugins in ~/.zshrc under plugins:

plugins=(git
         zsh-syntax-highlighting
         zsh-autosuggestions)

Tools

Git

A distributed version-control system for tracking changes in source code.

Atlassian | Wiki | Installation

There are several ways to install Git on a Mac. The easiest is probably to install the Xcode Command Line Tools. On Mavericks (10.9) or above you can do this simply by trying to run git from the Terminal the very first time.

git --version

If you don’t have it installed already, it will prompt you to install it.

If you want a more up to date version, you can also install it via a binary installer. A macOS Git installer is maintained and available for download at the Git website.

You can also install it as part of the GitHub for macOS install. Their GUI Git tool has an option to install command line tools as well. You can download that tool from the GitHub for macOS website.

vim syntax highlighting

To enable the syntax coloring for vim, go to your home directory, and open or create the .vimrc file if it doesn’t already exist.

Codexpedia

cd ~
vim .vimrc
filetype plugin indent on
syntax on

Toggle syntax highlighting in Vim, press Esc and then type the below and enter:

:syntax <on|off>

Gatsby

Gatsby is a React-based, GraphQL powered, static site generator. It uses powerful preconfiguration to build a website that uses only static files for incredibly fast page loads, service workers, code splitting, server-side rendering, intelligent image loading, asset optimization, and data prefetching.

MediaCurrent | Gatsby

npm install -g gatsby-cli

Emacs

Emacs is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as “the extensible, customizable, self-documenting, real-time display editor”.

Wiki | emacsformacosx

Spacemacs

It can take advantage of all of GNU Emacs’ features, including both graphical and command-line user interfaces, and being executable under X Window System and within a Unix shell terminal.

Spacemacs consists mainly of configuration files, pre-defined internal commands, and configurations for various plug-ins (called ‘packages’).

It has three user-selectable input modes: Emacs mode, Vim mode (based on the evil Emacs package for Vim emulation), and Hybrid mode.

Wiki | Practicalli

In my case, Emacs could not verify the GPG signatures of packages downloaded from elpa. I applied the following workaround:

Modify the init.el in .emacs.d/initl.el, and add at or near the top of the file the following line; (setq package-check-signature nil)

Then the spacemacs configuration (edit ~/.spacemacs) needs to be modified to allow the editor to download packages from elpa via unsecure channels, this is done by modifying the following settings; dotspacemacs-elpa-https nil

Perhaps this will work to solve the issue instead of disabling the signature check and https. I haven’t tried it yet.

brew install gnupg

When using helm, and helm-ag, the executable for silver surfer (ag) needs to be but onto your path so that emacs can find and use it.

brew install the_silver_searcher

GitHub

.spacemacs config

Keep a copy of your config under version control in the event something goes wrong when you change it.

Gist (configuration) | Practicalli

themes

Press SPC T n to cycle to the next theme in the list I now use apropospriate-dark configured under themes in the .spacemacs configuration file.

GitHub

Treemacs layer

This layer sets up a file navigation and project explorer side-window via Treemacs.

Layer | Keybindings

(setq-default dotspacemacs-configuration-layers '(
  (treemacs :variables
            treemacs-use-follow-mode t
            treemacs-use-filewatch-mode t
            treemacs-use-collapsed-directories 3
            treemacs-lock-width t)))

Adjusting window sizes

You may have a configuration where the golden ratio or zoom has been configured. Your windows won’t be balanced (equal sizes when windows are split). Windows are expanded when they are focused while other windows appear smaller.

  • Toggle zoom SPC t g
  • Toggle golden ratio mode SPC SPC > golden-ratio-mode
  • Balance windows area SPC w =

References

The following wiki, pages and posts are tagged with

TitleTypeExcerpt
basic setup using mac's new gpu post Wed, Oct 20, 21, initial setup on mac machine
Resources for DS & ML & DL post Mon, Oct 25, 21, bugs and tuts lists books services & api frameworks
Data combining using pandas post Tue, Oct 26, 21, Coupling multiple dataframes together uisng dataFrame and series
Dataset Collection for dl ml sources post Tue, Oct 26, 21, datasets for Scikt-learn, public google and nlp projects with awesome-public-datasets, Open Images V6
Practical Machine Learning Tools and Techniques post Tue, Dec 28, 21, owerpoint slides for Chapters 1-12. This is a very comprehensive teaching resource, with many PPT slides covering each chapter of the book
meet-puppeteer.md post javascript로 브라우저 자동화
Machine learning, deep learning, AI page DL/ML concept google search model 𝗔𝗿𝘁𝗶𝗳𝗶𝗰𝗶𝗮𝗹 𝗜𝗻𝘁𝗲𝗹𝗹𝗶𝗴𝗲𝗻𝗰𝗲 𝗣𝗿𝗼𝗷𝗲𝗰𝘁 𝗟𝗶𝘀𝘁
webscraping page webscraping lessons, rapa, blackyak, 100 famous mountains, github actions and python install