July 31, 2019

Macを買った時に設定すること

新しいPCを買ったり、PCが壊れて一時的に代替機を使う場面であったり、入社したりと、何かと新しくPCを設定する場面というのは少なくは無い。
その度に、あれこれはどうなっていたっけ?とか設定を見直すのは面倒なものである。
普段はEvernoteに一通りの設定の手順をメモっていたが、セキュリティの都合でEvernoteが使えない場面があって不便だったのと、意外と他人の設定を見ると発見にもなると思うので、WEB上にもメモっておく。 普段使いのPCはWindowsが好きだけど、開発はMacの方がしやすいので、この記事はMac前提になっている。
ショートカットは完全に個人的なやつなので、よしなに🙏

表記

本記事での表記。

各設定項目の [タブ]

  • チェックボックス

Shell, 開発関連

基本的にzsh, vim, pyenv等のコマンドで設定可能な各種開発環境に関しては、 GitHub上のdotfilesリポジトリ で管理してるMakefileを使って、コマンド1つでインストール出来るようにしている。

https://github.com/AAkira/dotfiles/blob/master/Makefile

  • git clone
    $ git clone https://github.com/AAkira/dotfiles.git
  • ホームディレクトリにコピー
    $ make install
  • Macで使うソフト類のインストール
    $ make mac
  • 個別にインストールする場合
    $ make install-zsh
    $ make install-vim

Finder

上部にパスを表示

$ defaults write com.apple.finder _FXShowPosixPathInTitle -boolean true && killall Finder

パスバー表示

Option + Command + p

Finderの隠しファイル表示

$ defaults write com.apple.finder AppleShowAllFiles true && killall Finder off

環境設定

表示ディレクトリ変更

[サイドバー] >

  • home directory
  • iCloud Drive

拡張子表示

[詳細] >

  • すべてのファイル名拡張子を表示

Mac システム環境設定

OSのシステム環境設定

一般

デフォルトのブラウザをChromeにする

デフォルトのWebブラウザ > Google Chrome.app

Dock

自動表示

  • Dockを自動的に表示/非表示

最近のアプリ非表示

  • 最近使ったアプリケーションをDockに表示

Mission Control

仮想デスクトップの位置を固定する

  • 最新の使用状況に基づいて操作スペースを自動的に並べ替える

ディスプレイ

輝度調整

  • 輝度を自動調整
  • True tone

キーボード

Touch Bar

  • [キーボード]
    Touch Barに表示する項目 > F1, F2などのキー

  • [キーボード]
    Fnキーを押して > Control Stripを表示

  • [キーボード]
    Touch Barをカスタマイズ

  • [キーボード]
    外部キーボードのF1, F2などのキーを標準のファンクションキーとして使用

[キーボード]

輝度調整
  • 環境光が暗い場合にキーボードの輝度を調整
キーボードビューア
  • メニューバーにキーボードビューアと絵文字ビューアを表示
キーのリピート速度

1番速く

=======================▼
オフ 遅い             速い
リピート入力認識までの時間

上から2番目(短く)

===================▼====
長い                 短い

[ショートカット]

Misson Control
  • Mission Control

  • JIS
    ctrl+↑ => ctrl+:

  • US
    ctrl+↑ => ctrl+'

  • 左の操作スペースに移動
    ctrl+← => ctrl+L

  • 右の操作スペースに移動
    ctrl+→ => ctrl+;

キーボード
  • アプリ内での切り替え(⌘+TABのアプリ版)
    次のウインドウを操作対象にする > ⌥ + TAB
アプリケーション
  • スリープ

アプリケーション > +押して作成

項目設定
アプリケーション全アプリケーション
メニュータイトルスリープ (必ず日本語で、英語設定の場合はメニューバーに表示されてる名前と同じにする)
キーボードショートカット⌘⇧¥
  • コピペスタイル

アプリケーション > +押して作成

項目設定
アプリケーション全アプリケーション
メニュータイトルペーストしてスタイルを合わせる
キーボードショートカット⌘V

サウンド

  • メニューバーに音量を表示

iCloud

同期設定

  • iCloud Drive
  • リマインダー
  • Safari
  • メモ
  • キーチェーン
  • Macを探す
  • 株価

Touch ID

指紋追加

アクセシビリティ

ズーム

[ズーム機能] > スクロールジェスチャと修飾キーを使ってズーム > ^Control

共有

コンピュータ名変更

コンピュータ名を変える

Siri

SiriをOFFにする

  • “Siriに頼む"を有効にする
  • メニューバーにSiriを表示

日付と時刻

日付を表示

[時計] >

  • メニューバーに日付と時刻を表示
  • 曜日を表示
  • 日付を表示

Others

バッテリー%表示

メニューバー > 右クリック > 割合(%)を表示

スクショのフォーマットをJPEGにする

$ defaults write com.apple.screencapture type jpg

スクショの影を消す

$ defaults write com.apple.screencapture disable-shadow -boolean true

フォント

  • m+
  • [source code pro]
$ brew tap caskroom/fonts && brew cask install font-source-code-pro

Install softwares

Google Chrome

https://www.google.co.jp/chrome/

  • ログインする
  • Download先をDesktopに

Google日本語入力

https://www.google.co.jp/ime/

  • 英数(Google), ひらがな(Google)以外は削除
    環境設定 > キーボード > 入力ソース > Mac標準の入力を消す

Karabiner

https://pqrs.org/osx/karabiner/

設定はKey Binding

Better Touch Tool

https://folivora.ai

設定

  • Manage Presets > import
  • Basic Settings > Launch BetterTouchTool on start up

Key map

  • Global
ActionShortcut
F13^F13 (ctrlと同時押しすることがよくあるので)
ウィンドウを左に最大化⌘⇧← (Windows like)
ウィンドウを右に最大化⌘⇧→
  • Chrome
ActionShortcut
^N
^P
  • Slack
ActionShortcut
⌥⇧↓^C
⌥⇧↑^X
⌥↑^W
⌥↓^S
Fn↑^I
Fn↓^M
Esc^[

Alfred

https://www.alfredapp.com/

ショートカット

[Features] >

  • 辞書のPrefixを1文字に
    Dictionary > Define a word > define -> d

  • GoogleのPrefixを1文字に
    Web Search > google -> g

  • Google USのみの結果表示 Web search > Add Custom Search

KeyValue
Search URLhttps://www.google.com#gl=us&hl=en&gws_rd=cr&pws=0&q={query}
TitleUS only
Keywordgu

Slack

https://slack.com/intl/ja-jp/downloads/mac

  • Download先をDesktopに

Cot Editor

https://coteditor.com

  • デフォルトで開く拡張子変更
$ brew install duti
$ duti -s com.coteditor.CotEditor txt all
$ duti -s com.coteditor.CotEditor json all
$ duti -s com.coteditor.CotEditor xml all
$ duti -s com.coteditor.CotEditor kt all
$ duti -s com.coteditor.CotEditor java all
$ duti -s com.coteditor.CotEditor css all

Intellij

IDEA
Android Studio

iTerm2

https://www.iterm2.com/

設定を読み込む

  • mkdir $HOME/iterm2
  • Preferences > [General] > Load preferences from a custom folder or URL -> $HOME/iterm2
    上記のフォルダに保存していたplistを入れてappearanceの復元

スクロールの上限を無限にする

[Profiles] > Terminal > Unlimited scrollback

Docker for desktop

https://www.docker.com/products/docker-desktop
https://hub.docker.com/editions/community/docker-ce-desktop-mac

  • ログイン
    $ docker login

Source Tree

https://www.sourcetreeapp.com

Key binding

Mac環境設定

修飾キー >

内蔵

Karabiner使うので変えなくても良い

Karabiner VirtualHIDKeyboard

  • JIS
キーアクション
Caps Lock^ Control
Control⌥ Option
Option⌥ Option
Command⌘ Command
FunctionFn Function
  • US
キーアクション
Caps Lock^ Control
Control⌥ Option
Option⌥ Option
Command⌘ Command
FunctionFn Function

認識速度

環境設定 > キーボード > キーのリピート, リピート入力までの時間

  • キーリピート速度を設定(小さい程速い)
    $ defaults write -g KeyRepeat -int 1
  • キーリピート開始速度の早さを設定(小さい程早い)
    $ defaults write -g InitialKeyRepeat -int 25
  • 現在のキーリピート速度を表示
    $ defaults read -g KeyRepeat
  • 現在のキーリピート開始速度を表示
    $ defaults read -g InitialKeyRepeat
  • キーリピート速度をデフォルトに戻す
    $ defaults delete -g KeyRepeat
  • キーリピート開始速度をデフォルトに戻す
    $ defaults delete -g InitialKeyRepeat

Karabiner

日本語Toggle切り替え

  • 一回適当なキーをf13に割当てる
  • 環境設定 > [キーボード] > ショートカット > 入力ソース > 前の入力ソースを選択 > f13に割当てる
  • Karabinerでかなキーをf13に割り当てる

Functionキーとキーボードの同時押しを有効にする

デフォルトだとキーボードとの同時押しが対応していない

[Devices] >

  • No Product Name
  • Apple Internal Keyboard

環境設定

[Simple Modifications] >

For All device

  • JIS
From keyTo key
かなキーf13
right_commandf13
Option⌥ Option
Command⌘ Command
FunctionFn Function
  • US
From keyTo key
left_controlleft_option
Control⌥ Option
Option⌥ Option
Command⌘ Command
FunctionFn Function

MD600

  • JIS
From keyTo key
caps_lockleft_control
grave_accent_and_tide(`)escape
international4f13
left_commandleft_option
left_controlright_command
  • US
From keyTo key
caps_lockcaps_lock
grave_accent_and_tide(`)escape
international4f13
left_gui(equal to left_command)left_option
left_controlright_command

RealForce

  • JIS
From keyTo key
caps_lockleft_control
left_controlleft_command
PCキーボードの変換キーf13

本体USキーボード、外付けJISキーボード、
本体JISキーボード、外付けUSキーボードみたいな組み合わせは難しい。

© AAkira 2023