26
33

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の初期設定 defaults write comandなど

Last updated at Posted at 2020-05-22

はじめに

インストールするものに依存関係があるので、以下の手順は必須です。

  1. ソフトウェア・アップデート
  2. xcode インストール
  3. homebrew インストール
  4. 各種コマンドのインストール、アップデート
  5. zshでpreztoの設定
  6. Python、Rubyをアップデート
  7. デスクトップアプリケーションのインストール

Apple IDでログインせずにスタート

ホームディレクトリの名前をsimpleなものにしたいので、後でログインする。

基本設定

自己責任でご使用ください。

# 動きを高速化
defaults write -g com.apple.trackpad.scaling 3 && \
defaults write -g com.apple.mouse.scaling 1.5 && \
defaults write -g KeyRepeat -int 1 && \
defaults write -g InitialKeyRepeat -int 10

## タップしたときクリック
defaults write -g com.apple.mouse.tapBehavior -int 1

## 三本指でドラッグ
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true && \
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool true

## スクロールバーを常時表示する
defaults write -g AppleShowScrollBars -string "Always"

## クラッシュレポートを無効化する
defaults write com.apple.CrashReporter DialogType -string "none"    

## 未確認のアプリケーションを実行する際のダイアログを無効にする
defaults write com.apple.LaunchServices LSQuarantine -bool false 

## ダウンロードしたファイルを開くときの警告ダイアログをなくしたい
defaults write com.apple.LaunchServices LSQuarantine -bool false

# ゴミ箱を空にする前の警告の無効化
defaults write com.apple.finder WarnOnEmptyTrash -bool false

## 一度再起動
sudo shutdown -r now

## アニメーション無効

## ウィンドウを開閉するときのアニメーションを無効
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false

## ウィンドウサイズを調整する際の加速再生
defaults write -g NSWindowResizeTime -float 0.001

## Finderで情報ウィンドウを開くときのアニメーションを無効
defaults write com.apple.finder DisableAllAnimations -bool true

## Quick Lookウィンドウのアニメーションをオフ
defaults write -g QLPanelAnimationDuration -float 0

## Dockからアプリを起動するときのアニメーションを無効
defaults write com.apple.dock launchanim -bool false

# その他

## テキストエディットをプレーンテキストで使う
defaults write com.apple.TextEdit RichText -int 0

## スペルの訂正を無効にする
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false

## 他のMacで購入したアプリを自動的にダウンロードする
defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1

## terminalでUTF-8のみを使用する
defaults write com.apple.terminal StringEncodings -array 4

## ネットを早くする
networksetup -setdnsservers Wi-Fi 2001:4860:4860::8844 2001:4860:4860::8888 8.8.4.4 8.8.8.8

## 隠しファイルを常にファインダーに表示する
defaults write com.apple.finder AppleShowAllFiles -bool YES && \
killall Finder

## スクリーンショットをjpgで保存
defaults write com.apple.screencapture type jpg

## 全ての拡張子のファイルを表示する
defaults write -g AppleShowAllExtensions -bool true

## Finder のタイトルバーにフルパスを表示する
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true    

## 名前で並べ替えを選択時にディレクトリを前に置くようにする
defaults write com.apple.finder _FXSortFoldersFirst -bool true

## 一度再起動
sudo shutdown -r now

.DS_Storeファイルを作らせない

公式でも認めている方法なので、以下を実行します。

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

macOS で SMB ブラウジングの動作を調整する - Apple サポート (日本)

Xcode

まずは、**ソフトウェアアップデートを行ってください。**その後、Xcodeのインストールです。

Homebrewや他のパッケージをインストールする前にインストールしてください!
Xcodeをインストール。
App Store > 「Xcode」で検索 しインストールします。

ついでに「Tools for Xcode」も入れるために以下のコマンドを実行します。

xcode-select --install

Homebrew

macOS用パッケージマネージャー — Homebrew

パッケージマネージャを利用した Node.js のインストール | Node.js

Homebrew/homebrew-cask: 🍻 A CLI workflow for the administration of macOS applications distributed as binaries

zshの初期設定 preztoの設定

設定をする前にzshのフレームワークを設定します。

sorin-ionescu/prezto: The configuration framework for Zsh

以下のコマンドを実行

git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" && \
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
~/.zpreztorc
#
# Prompt
#

# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
#### sorinをpureに書き換え
# zstyle ':prezto:module:prompt' theme 'sorin'
zstyle ':prezto:module:prompt' theme 'pure'


<~~ 省略 ~~>

#### 'syntax-highlighting' と 'autosuggestions' を追記
# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory' \
  'spectrum' \
  'utility' \
  'completion' \
  'syntax-highlighting' \
  'autosuggestions' \
  'prompt' \
source ~/.zpreztorc
brew install composer && \
brew install git && \
brew install tree && \
brew install vim && \
brew install commitizen

gitの設定

sshを設定する

GitHubでssh接続する手順~公開鍵・秘密鍵の生成から~ - Qiita

その他の設定

Gitをインストールしたら真っ先にやっておくべき初期設定 - Qiita

# ユーザーネームの設定
git config --global user.name "My Name"
git config --global user.email myname@example.com

# 色付け
git config --global color.diff auto && \
git config --global color.status auto && \
git config --global color.branch auto

# デフォルトのエディタをvimに設定
git config --global core.editor 'vim -c "set fenc=utf-8"'

# グローバル設定
mkdir -p .config/git && vim $_/ignore
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

gitignoreの環境ごとの設定が乗っています。
参考: gitignore/macOS.gitignore at master · github/gitignore

Pythonを最新バージョンに

pyenv/pyenv: Simple Python version management

# ついでにpipをupgrade
pip install --upgrade pip

# その他入れるもの
pip3 install jupyterlab && \
pip3 install selenium && \
pip3 install requests && \
pip3 install beautifulsoup4 && \
brew install geckodriver && \
brew install chromedriver

Node.jsのインストール

nodenv/nodenv: Manage multiple NodeJS versions.

PHPを最新バージョンに

(Mac)phpbrewでPHPのバージョンを切り替える | Points & Lines

Rubyを最新バージョンに

rbenvを使って行います。詳しくはこちら
rbenv/rbenv: Groom your app’s Ruby environment

homebrew-cask

brew install --cask google-chrome
brew install --cask zoomus && \
brew install --cask discord && \
brew install --cask google-japanese-ime && \
brew install --cask visual-studio-code && \
brew install --cask docker && \
brew install --cask alfred && \
brew install --cask appcleaner && \
brew install --cask the-unarchiver && \
brew install --cask insomnia && \
brew install --cask karabiner-elements && \
brew install --cask flux && \
brew install --cask iterm2

Google日本語入力の設定変更

英数記号等をすべて半角で入力されるようにします。

Google日本語入力で英数字を常に半角で入力するようにする設定が細かいけど便利!

設定ファイルのクラウド化

Google日本語入力の辞書ツールを、複数のMacで同期する方法 | iSchool合同会社

フォントのダウンロード

源真ゴシック (げんしんゴシック) | 自家製フォント工房

音声読み上げ機能の設定

日本語の読み上げはKyokoで設定

速度も上限値で設定

ショートカットは’Ctrl + s‘

参考: Macの音声読み上げ機能を限界を超えて爆速にする方法(自己責任) - Qiita

英語の読み上げも設定する

Mac 読み上げ言語を切り替えるshell script - Qiita

DNSサーバの設定コマンド

GoogleのDNSを一括で設定します。

networksetup -setdnsservers Wi-Fi 2001:4860:4860::8844 2001:4860:4860::8888 8.8.4.4 8.8.8.8

# 設定を確認するには以下のコマンド
networksetup -GetDNSServers "Wi-Fi"

コマンドを最新化

テキスト処理のための標準的なコマンド群の macOS への導入手順 - Qiita

常にプレーンテキストで貼り付け

  1. 環境設定
  2. キーボード
  3. ショートカット
  4. アプリケーション
  5. +を押して「ペーストしてスタイルを合わせる」で⌘Vを登録

iTerm2の設定

iTerm2のおすすめ設定〜ターミナル作業を効率化する〜 - Qiita

広告の非表示

Preferences -> Advanced -> serch bar に "Suppress offer to silence bell when it rings too much"で検索して、項目をyesに変更

終了時の確認ダイアログを非表示に

Preferences -> Profiles -> Session -> Prompt before closing?でNeverを選択
General -> Closing でチェックをすべてオフ

ことえりの設定

Google日本語入力を使っていますが、ことえりの自分設定も。

  • Windows風のキー操作
    • 環境設定 -> キーボード -> 入力ソース -> 日本語(ローマ字入力) -> 「windows風のキー操作」にチェック

Spotlightの無効化

システム環境設定 -> Spotlight -> Privacy

appleSSD等のハードディスク自体を入れる

ss 2.png

システム環境設定 -> Spotlight -> Search Results

全ての項目をオフ

ss 3.png

初期化処理

vim, zsh, karabinerのconfigファイルをクラウドへ

参考

MacOS で設定する defaults コマンドをまとめてみた - Corredor

MacOS defaults コマンドをマスターする -- Think Abstract

俺が使う最強のMac構築手順書 - Qiita

26
33
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
26
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?