0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

私の Mac / Macbook のおすすめ初期設定 – OSシステム設定 / Google日本語入力 / VsCode / Alfred / Git / zsh / iTerm2 など

Last updated at Posted at 2023-12-17

Mac OSの設定

設定メニューの探し方は、メニューの階層を辿っていくより、キーワード検索してしまうのが手っ取り早い

image

カーソル移動速度を上げる

image

修飾キーでCapsLockをCommandにする

image

Option + Tab で同じアプリ内のウィンドウを切り替え可能にする

キーボードショートカット > キーボード > 「次のウィンドウを操作対象にする」で Option+tabを設定する

image

トラックパッドでサイレントクリックをオンにする

指を押し込まずにクリックできるようになる

image

トラックパッドで3本指ドラッグを設定

サイレントクリック有効時はこの設定は必須

image

誤操作の多いトラックパッドのぺージ間スワイプを無効にする

image

通知センターのトラックパッドジェスチャーを無効にする

image

Dockを自動的に隠す

Dockを自動的に表示/非表示をオンにする

image

画面下のこのバーが自動的に隠れるようになる

image

Dock で最近使ったアプリを非表示にする

「アプリの提案最近使用したアプリをDockに表示」を無効に

image.png

ホットコーナーのショートカット

ホットコーナーのショートカットでデスクトップを表示できるようにする
以下設定ではカーソルを画面左下に持ってくると、いつでもデスクトップが表示できるようになる

image

時刻を日本時間に

位置情報サービスをオンにしないと日本時間にできないかも?

image image

Google Chrome をインストール

デフォルトのWebブラウザに設定しておく

image

IME

Google日本語入力

環境設定で「半角スペース」「バックスラッシュ」の設定をする

image image

入力補助の設定でプログラミングで使う文字を「半角」に強制する

image

( 2023/12/16現在、なぜかMacの「サイレントクリック」だと変更が反映されず、トラックパッドを指で押し込んだら反映された )

入力ソースをGoogle日本語入力のひらがな・英字だけにする。

Mac OSの設定の「キーボード設定」で利用する入力ソースをGoogle日本語入力のひらがな・英字だけにする。
(Mac標準の英字は消せないのでそのままに)

image

Divvy

個人的必須Macアプリ

キーボードショートカットでウィンドウを画面いっぱいに表示できるようになる

image image

( フルスクリーンの全画面表示ではないので、こんな風にデスクトップが分かれてしまわないのが良い )

image

Alfred

個人的必須アプリ
クリップボード履歴を使うために必要 (ただしパワーパックが必要で有料)

Alfredの設定

  • Keep Plain Text / Keep Images などの保持期間を長くしておく
  • Command+Ctrl+V をショートカットに割り当てると、他ショートカットとも干渉せずに使いやすい

image

プログラミングの開発用

Home Brew をインストール

profileファイル ( ~/.zshrc ~/.bashrc とか ) などに以下を追加して brew コマンドを利用できるようにする

eval $(/opt/homebrew/bin/brew shellenv)

VsCode をインストール

設定

コンソールでcodeコマンドを使えるようにして、コンソールからVsCodeを開けるようにする
Command+Shift+Pでコマンドパレットを表示して、VsCodeコマンドを実行すればインストールできる

image

Docker For Mac

必要あればCPU/メモリの制限設定を変える

image

pecoのインストール

brew install peco

profileファイル ( ~/.zshrc ~/.bashrc とか ) に以下設定を追加すると、コンソールでCtrl+Rのショートカットで、インタラクティブにコマンド履歴を選択できるようになる

function peco-history-selection-keep() {
  BUFFER=$(history -n 1 | tail -r  | awk '!a[$0]++' | peco --layout=bottom-up --query="$BUFFER" --print-query | tail -n 1)

  CURSOR=$#BUFFER
}
zle -N peco-history-selection-keep
bindkey '^R' peco-history-selection-keep

image

iTerm2 のおすすめ設定

別記事を参照
https://qiita.com/YumaInaura/items/652a0229011270f486f0

git

Gitをインストール

gitコマンドを入力したらXcodeのインストールをうながされて、Xcodeと同時にインストールされたような

$ git --version
git version 2.39.3 (Apple Git-145)

brew で入れる場合はこう

brew install git

profileファイルに以下を設定

export PATH="/opt/homebrew/bin:$PATH"

brew の方が少しバージョンが新しい

git --version
git version 2.43.0

~/.gitconfig のエイリアス設定

[alias]
  # 普通のエイリアス
  ck = checkout
  br = branch
  st = status -s
  ; cp = cherry-pick

  # 現在のブランチを表示
  current = !git symbolic-ref --short HEAD

  update = !git add . && git commit -m "update"

  # originからpullする
  pull-from-origin = !git pull origin $(git current)
  po = pull-from-origin

  # なにも変更差分がない状態でコミットを作ってpushする
  pr = "!sh -c 'git checkout -b $1 && git commit --allow-empty -m $1 && git push' -"

  # 現在ブランチをリモート(origin)の最新の状態に書き換える
  reset-current = !git fetch && git reset --hard origin/$(git current)


  # 現在のコミットを壊してコミット未反映状態にする
  break = reset HEAD^

  # 今の作業内容をammendする
  forget = !git add . && git commit --amend
  fg = !git forget

  cm = commit
  cma = commit --amend
  amend = commit --amend

  # 新規コミットを作る
  create = !git add . && git commit
  cr = !git create

  # rebaseでもmergeでもcherry-pickでもabortする
  abort = !git rebase --abort || git merge --abort | git cherry-pick --abort

  # rebaseの時の変更を反映する
  change = !git add . && git rebase --continue

  # コミットされていないものはすべて消す
  vanish = !git reset . && git checkout . && git clean -fd

zsh

zshを利用している場合の設定 (おすすめ)

zshの設定

~/.zshrc

# zsh基本設定
export EDITOR=vim

autoload colors
colors
PROMPT="%{${fg[green]}%}%(!.#.$) %{${reset_color}%}"

zstyle ':completion:*:*:git:*' script ~/.zsh/git-completion.bash
fpath=(~/.zsh $fpath)
autoload -Uz compinit && compinit

export LANG=en_US.UTF-8

zstyle ':completion:*' ignore-parents parent pwd ..

HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt hist_ignore_dups
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt hist_reduce_blanks
setopt hist_no_store
setopt share_history
setopt auto_pushd
setopt pushd_ignore_dups
set paste

export LSCOLORS=gxfxbxdxcxegedabagacad
zstyle ':completion:*' list-colors $LSCOLORS

# PROMPT ^ gitで現在のブランチを表示する
RPROMPT="%1(v|%F{green}%1v%f|) [%~]"
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '[%b|%a]'
function precmd_vcs() {
  psvar=()
  LANG=en_US.UTF-8 vcs_info
  [[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
precmd_functions+=(precmd_vcs)

# COLORING
export LSCOLORS=gxfxbxdxcxegedabagacad
zstyle ':completion:*' list-colors $LSCOLORS

# peco
function peco-history-selection-keep() {
  BUFFER=$(history -n 1 | tail -r  | awk '!a[$0]++' | peco --layout=bottom-up --query="$BUFFER" --print-query | tail -n 1)

  CURSOR=$#BUFFER
}
zle -N peco-history-selection-keep
bindkey '^R' peco-history-selection-keep

# brew
eval $(/opt/homebrew/bin/brew shellenv)

# brew git
export PATH=/usr/local/bin/git:$PATH

Vimの設定

~/.vimrc

set clipboard+=unnamed

:syntax on

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?