557 words
3 minutes
Winユーザー的MacOSのセットアップ
動機
メイン環境と切り離してやりたい作業ができた際に手持ちの環境で一番パフォーマンスが良いのがMacBookAir 2020だった。
スペック
CPU: Apple M1
RAM: 8GB
用途
- セットサーフィン
- VSCode + Remote-SSH で開発
- その他pythonとかで色々
やったことリスト
Homebrewの導入
これがないと始まらない
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/hoge/.zprofileeval $(/opt/homebrew/bin/brew shellenv)パッケージの導入
brew install fastfetch git python3 zplugCask
brew install --cask font-hackgen git-credential-manager google-chrome google-japanese-ime iterm2 karabiner-elements visual-studio-codeAppStoreでBitwardenを入れた(ssh agentが便利)
キーボードの設定
- 設定 > キーボード > キーボードショートカット
ファンクションキーを標準化。
修飾キー設定でCommandとControlを入れ替える
- Karabiner-Elements Setting > Complex Modifications > Add predefined rule > Import more rules from the internet
For Japanese をインポートして Caps Lockを英数/かなのトグルに変更する を反映
zshの設定
.zshrcをhomeディレクトリに配置
- .zshrc
# Envexport EDITOR=vimexport RSYNC_RSH=sshexport HISTFILE=$HOME/.zsh-historyexport HISTSIZE=100000export SAVEHIST=1000000export WORDCHARS='*?_.[]~-=&;!#$%^(){}<>'export SSH_AUTH_SOCK=~/Library/Containers/com.bitwarden.desktop/Data/.bitwarden-ssh-agent.sockexport PATH="$(brew --prefix python)/libexec/bin:$PATH"
# Aliasalias ls='ls --color=auto'alias grep='grep --color=auto'
# Generalautoload -Uz colors ; colorssetopt auto_cdsetopt auto_pushdsetopt pushd_ignore_dupssetopt no_flow_controlsetopt extended_globsetopt histignorealldupssetopt share_historysetopt hist_ignore_all_dupssetopt inc_append_historysetopt menu_completeautoload -Uz compinit ; compinitsetopt correctzstyle ':completion:*' menu selectsetopt list_packedzstyle ':completion::complete:*' use-cache trueautoload -U colors ; colors ; zstyle ':completion:*' list-colors "${LS_COLORS}"zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'zstyle ':completion:*:manuals' separate-sections truesetopt magic_equal_substautoload -Uz vcs_infosetopt prompt_substzstyle ':vcs_info:git:*' check-for-changes truezstyle ':vcs_info:git:*' stagedstr "%F{magenta}!"zstyle ':vcs_info:git:*' unstagedstr "%F{yellow}+"zstyle ':vcs_info:*' formats "%F{cyan}%c%u[%b]%f"zstyle ':vcs_info:*' actionformats '[%b|%a]'setopt prompt_substautoload -U add-zsh-hookzle -N peco-history-selectionprecmd () { vcs_info }PROMPT='%F{magenta}$(arch)%f@%F{blue}%m%f:%F{green}%1~%f%F{cyan}$vcs_info_msg_0_%f%F{white}$%f '
# zplugsource /opt/homebrew/opt/zplug/init.zsh
zplug "zsh-users/zsh-completions"zplug "zsh-users/zsh-autosuggestions"zplug "mollifier/cd-gitroot"zplug "zsh-users/zsh-syntax-highlighting", defer:2zplug "b4b4r07/enhancd", use:init.sh
if ! zplug check --verbose; then printf "Install? [y/N]: " if read -q; then echo; zplug install fifi
zplug load --verbose > /dev/nullFinderからiTerm2/VSCodeを開く
Finderで開いているディレクトリをカレントディレクトリとして開くショートカットをAutomatorで作る。
アプリケーション > AppleScriptを実行
- iTerm2の場合
on run {input, parameters}
tell application "Finder" set hfsCurrentFolder to insertion location as alias set currentFolder to POSIX path of (hfsCurrentFolder as text) end tell
set command to "cd " & quoted form of currentFolder
tell application "iTerm" activate
try set newWindow to (create window with default profile) on error set newTab to (create tab with default profile) end try
tell current session of current window write text command end tell end tell
end run- VSCodeの場合
on run {input, parameters} tell application "Finder" set hfsCurrentFolder to insertion location as alias set currentFolder to POSIX path of (hfsCurrentFolder as text) end tell
do shell script "open -a 'Visual Studio Code' " & quoted form of currentFolderend run作ったアプリケーションをControlを押しながらFinderのツールバーに持っていくと使用できる。
Winユーザー的MacOSのセットアップ
/posts/2025-08-08-macbook-setup/ Some information may be outdated