Closed7

M2 Mac 環境構築

tkc310tkc310

macOS Ventura 13.5

xcode & command line tools

最新の安定版をインストール
https://developer.apple.com/download/all/

zsh & homebrew

https://brew.sh/

$ cd ~
$ touch .zprofile
$ touch .zshrc
$ echo "source ~/.zprofile" >> .zshrc

# homebrew
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> .zprofile
$ source .zshrc
$ brew -v
# => Homebrew 4.1.6

## zshテーマ
$ brew install romkatv/powerlevel10k/powerlevel10k
$ echo "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >> ~/.zprofile
$ reload
$ exit
# 再起動してテーマ設定する

https://github.com/romkatv/powerlevel10k#powerlevel10k

https://github.com/tkc310/settings/blob/main/.zprofile
https://github.com/tkc310/settings/blob/main/.zshrc
https://github.com/tkc310/settings/blob/main/.gitconfig?cache=false

asdf

$ brew install asdf
$ echo ". $(brew --prefix asdf)/libexec/asdf.sh" >> .zprofile
$ reload
# nodejs
$ asdf plugin-add nodejs 
$ asdf install nodejs 20.5.1
$ asdf global nodejs 20.5.1
$ asdf plugin-add pnpm
$ asdf install pnpm latest
$ asdf reshim
$ reload
$ node -v
#=> V20.5.1
$ pnpm -v
# => 10.6.5 
# java (firebase emulator用に19.xをインストール)
$ asdf plugin-add java https://github.com/halcyon/asdf-java.git
$ asdf list-all java
# => list versions
$ asdf install java corretto-19.0.2.7.1
$ asdf global java corretto-19.0.2.7.1
$ echo ". ~/.asdf/plugins/java/set-java-home.zsh" .zprofile
$ asdf reshim
$ reload
$ java -version
#=> openjdk version "19.0.2" 2023-01-17
# 2025/3/25時点でasdfのコマンド変わってる
$ asdf plugin add python
$ asdf list all python
$ asdf install python 3.13.2
$ asdf set -u python 3.13.2 # -u付きでglobal / 無しでlocal
$ asdf plugin add poetry
$ asdf install poetry latest
$ asdf set -u poetry 2.1.1
$ asdf reshim
$ poetry config virtualenvs.in-project true
$ reload

.tool-versions だけでなく .node-version などのファイルをサポートする。
(versionを読み取る時に1行の方が何かと便利なのでこの形式を利用している)

$ touch ~/.asdfrc
$ echo "legacy_version_file = yes" >> ~/.asdfrc

githook

GUIツール用にパスを通しておく

$ touch .lefthookrc
$ echo "source ~/.zshrc"

Forkの場合は Fork > Settings > Git > ENV PATH: System shell 'bin/zsh' に変更

隠しファイル表示

$ defaults write com.apple.finder AppleShowAllFiles -bool true
$ killall Finder
tkc310tkc310

Google IME

開発版をダウンロード
https://www.google.co.jp/ime/#:~:text=iOS 版ダウンロード-,開発版ダウンロード,-CGI API デベロッパー

システム設定 > キーボード > 入力ソース

  • 左下 - から既存の日本語設定をすべて削除
  • 左下 + から日本語を2回追加すると「ひらがな(Google)、英数(Google)」がIMEに追加される
    このときキーボードレイアウトが表示されないので分かりにくい
tkc310tkc310

github

# @refs: https://docs.github.com/ja/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
$ ssh-keygen -t ed25519 -C "your@example.com"
$ pbcopy < ~/.ssh/id_ed25519.pub
# settings > SSH and GGP Keysから登録
$ git config --global user.name "tkc310"
$ git config --global user.email tkc310@example.com
このスクラップは2023/08/27にクローズされました