Skip to content

Setup Mac_M2

git

% git --version
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
% git --version
git version 2.32.1 (Apple Git-133)

brew (not necessary now)

% brew --version
zsh: command not found: brew

% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/yuichi/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"

% echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/yuichi/.zprofile
% eval "$(/opt/homebrew/bin/brew shellenv)"
% brew --version
Homebrew 3.6.0

git config

% git config -l
credential.helper=osxkeychain

% git config --global user.name "myname"
% git config --global user.email "myaddress@email.com"

% git config -l                                           
credential.helper=osxkeychain
user.name=myname
user.email=myaddress@email.com

ssh-key

% cd ~
% ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/yuichi/.ssh/id_rsa):
Created directory '/Users/yuichi/.ssh'.
Your identification has been saved in /Users/yuichi/.ssh/id_rsa
Your public key has been saved in /Users/yuichi/.ssh/id_rsa.pub

% cd .ssh
% ls
id_rsa      id_rsa.pub
% cat id_rsa.pub | pbcopy

gitlab

Right top icon -> Edit profile -> SSH Keys -> command+V

SSH (optional)

% ssh -T git@gitlab.fabcloud.org
The authenticity of host 'gitlab.fabcloud.org (13.59.248.79)' can't be established.
ED25519 key fingerprint is SHA256:WnuB9nH4cmBJGz2iMuj8ckmYNCq/M.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitlab.fabcloud.org' (ED25519) to the list of known hosts.
Enter passphrase for key '/Users/yuichi/.ssh/id_rsa':
Welcome to GitLab, @yuichitamiya!

git clone

% cd ~
% cd repos
% git clone git@gitlab.fabcloud.org:academany/fabacademy/2022/labs/kannai/site.git fa2022_kannai_site
% ls
fa2022_kannai_site

Python, pip

% python3 -V
Python 3.8.9
% pip -V
zsh: command not found: pip
% cd Downloads
% curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
% python3 get-pip.py
WARNING: The scripts pip, pip3 and pip3.8 are installed in '/Users/yuichi/Library/Python/3.8/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-22.2.2

% pip -V
zsh: command not found: pip
% pip3 -V
pip 22.2.2 from /Users/yuichi/Library/Python/3.8/lib/python/site-packages/pip (python 3.8)

mkdocs

% cd repos/fa2022_kannai_site
% ls
README.md       docs            requirements.txt
agreements      mkdocs.yml
% pip3 install -r requirements.txt
WARNING: The script watchmedo is installed in '/Users/yuichi/Library/Python/3.8/bin' which is not on PATH.
Successfully installed GitPython-3.1.27 Jinja2-3.0.3 Markdown-3.4.1 MarkupSafe-2.1.1 PyYAML-6.0 babel-2.10.3 click-8.1.3 ghp-import-2.1.0 gitdb-4.0.9 importlib-metadata-4.12.0 mergedeep-1.3.4 mkdocs-1.2.4 mkdocs-git-revision-date-localized-plugin-0.11.1 mkdocs-material-8.2.7 mkdocs-material-extensions-1.0.3 packaging-21.3 pygments-2.13.0 pymdown-extensions-9.5 pyparsing-3.0.9 python-dateutil-2.8.2 pytz-2022.2.1 pyyaml-env-tag-0.1 smmap-5.0.0 watchdog-2.1.9 zipp-3.8.1

% mkdocs serve
zsh: command not found: mkdocs

% pip3 install mkdocs
Requirement already satisfied: mkdocs in /Users/yuichi/Library/Python/3.8/lib/python/site-packages (1.2.4)

PATH

$ cd ~
% echo $SHELL
/bin/zsh
% nano .zshrc

nano

export PATH="/Users/yuichi/Library/Python/3.8/bin:$PATH"
control+X -> Yes

mkdocs serve

% cd repos/fa2022_kannai_site
% mkdocs serve
zsh: command not found: mkdocs

% source ~/.zshrc

% mkdocs serve
INFO     -  Building documentation...
INFO     -  [00:49:25] Serving on http://127.0.0.1:8000/2022/labs/kannai/

atom

install atom

https://atom.io/

instal packages

Atom -> Preferences -> Setting -> Install -> Search packages “tree-view-copy-relative-path”

open atom from Terminal

% open -a atom

alias

% cd ~
% nano .zshrc

nano

alias atom="open -a atom"

% source ~/.zshrc

% cd repos/fa2022_kannai_site
% atom .
Ref. ターミナルでのコマンドを短縮するためにエイリアスを設定する。〜快適にコマンドを打とう〜
Ref. Open Any Application from the Terminal

open Chrome

% cd
% cd /Applications
% ls
Google Chrome.app
% open -a "Google chrome"

% cd ~
% nano .zshrc

nano

alias chrome='open -a "Google chrome" http://127.0.0.1:8000/'

% source ~/.zshrc

% cd/repos/fa2022_kannai_site
% chrome
% mkdocs serve
-> open Mkdocs on chrome!!!


Last update: September 11, 2022