LoginSignup
1671
1869

More than 3 years have passed since last update.

iMac/MacBook購入後に必ず設定したい設定項目

Last updated at Posted at 2018-11-21

apple-logo-thum.jpg

背景

iMacやmacbookの買い替えなんかで購入直後に設定する項目のメモ
ターミナルから設定できます。dotfileとして置いておいて端末購入時に実行するやり方が基本のようです。
一度書いてしまえば端末購入のたびに実行するだけで同じ設定のマシンが瞬時に出来あがるのは素晴らしいですね。
vimrc同様に育てていく感覚が大事なのかも知れませんね()。

基本的には以下のリポジトリとサイトを参考に記載しています。

defaultsコマンドとは

「plist」と呼ばれるアプリやシステムの設定ファイルに、設定値を追加、変更、削除、検索するコマンドです。
標準のGUI設定では届かないかゆいところの設定が可能になります。

詳しくは下記をご参照ください
http://tukaikta.blog135.fc2.com/blog-entry-209.html

注意①

上記すべてを同時に実行すると正直使い勝手が返って悪くなると思います。
自分に合った設定を徐々に適用することをお勧めします

注意②

アプリによっては設定がキャッシュされている場合があります。
プロセスの再起動が必要ですので下記のような操作が必要です。

$ killall APPLICATION_NAME

# Finderなら
$ killall Finder

基本系

# スタンバイまでの時間を24時間へ変更 (デフォルト1時間)
$ sudo pmset -a standbydelay 86400

# ブート時のサウンドの無効化 (寂しい気もしますが煩いので消しています)
$ sudo nvram SystemAudioVolume=" "

# スクロールバーの常時表示
$ defaults write NSGlobalDomain AppleShowScrollBars -string "Always"

# コンソールアプリケーションの画面サイズ変更を高速にする
$ defaults write NSGlobalDomain NSWindowResizeTime -float 0.001

# フリーズすると自動的に再起動
$ sudo systemsetup -setrestartfreeze on

# スリープさせない
$ sudo systemsetup -setcomputersleep Off > /dev/null

# 自動大文字の無効化
$ defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false

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

# 時計アイコンクリック時にOSやホスト名ipを表示する
$ sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName

# Bluetoothヘッドフォン/ヘッドセットの音質を向上させる
$ defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40

Dock関連

# window効果の最大/最小を変更
$ defaults write com.apple.dock mineffect -string "scale"

# Dockで開いているアプリケーションのインジケータライトを表示する
$ defaults write com.apple.dock show-process-indicators -bool true

# 開いているアプリケーションのみをdockに表示
$ defaults write com.apple.dock static-only -bool true

# アプリケーション起動時のアニメーションを無効化
$ defaults write com.apple.dock launchanim -bool false

# すべての(デフォルトの)アプリアイコンをDockから消去する
$ defaults write com.apple.dock persistent-apps -array

# Dashboard無効化
$ defaults write com.apple.dashboard mcx-disabled -bool true

Finder関連

# アニメーションを無効化する
$ defaults write com.apple.finder DisableAllAnimations -bool true

# デフォルトで隠しファイルを表示する
$ defaults write com.apple.finder AppleShowAllFiles -bool true

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

# ステータスバーを表示
$ defaults write com.apple.finder ShowStatusBar -bool true

# パスバーを表示
$ defaults write com.apple.finder ShowPathbar -bool true

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

# 検索時にデフォルトでカレントディレクトリを検索
$ defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"

# 拡張子変更時の警告を無効化
$ defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

# ディレクトリのスプリングロードを有効化
$ defaults write NSGlobalDomain com.apple.springing.enabled -bool true

# スプリングロード遅延を除去
$ defaults write NSGlobalDomain com.apple.springing.delay -float 0

# USBやネットワークストレージに.DS_Storeファイルを作成しない
$ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
$ defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

# ディスク検証を無効化
$ defaults write com.apple.frameworks.diskimages skip-verify -bool true
$ defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
$ defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true

# ボリュームマウント時に自動的にFinderを表示
$ defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
$ defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
$ defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true

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

# Show the ~/Library folder
$ chflags nohidden ~/Library

# Show the /Volumes folder
$ sudo chflags nohidden /Volumes

Spotlight関連

# トレイアイコンを非表示
$ sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search

# メインディスクのインデックスの有効化
$ sudo mdutil -i on / > /dev/null

# インデックスの再構築
$ sudo mdutil -E / > /dev/null

Safari関連

# 検索クエリをAppleへ送信しない
$ defaults write com.apple.Safari UniversalSearchEnabled -bool false
$ defaults write com.apple.Safari SuppressSearchSuggestions -bool true

# tabキーでWebページの項目の強調
$ defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
$ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true

# アドレスバーに表示されるURLを全表示
$ defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true

# ファイルのダウンロード後に自動でファイルを開くのを無効化
$ defaults write com.apple.Safari AutoOpenSafeDownloads -bool false

# Safariのデバッグメニューを有効化
$ defaults write com.apple.Safari IncludeInternalDebugMenu -bool true

# Safariのブックマークバーから不要なアイコンを削除
$ defaults write com.apple.Safari ProxiesInBookmarksBar "()"

# スペルチェックを継続的に行う
$ defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true

# 自動修正の無効化
$ defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false

# オートフィルの無効化
$ defaults write com.apple.Safari AutoFillFromAddressBook -bool false
$ defaults write com.apple.Safari AutoFillPasswords -bool false
$ defaults write com.apple.Safari AutoFillCreditCardData -bool false
$ defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false

# プラグインの無効化
$ defaults write com.apple.Safari WebKitPluginsEnabled -bool false
$ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false

# Javaの無効化
$ defaults write com.apple.Safari WebKitJavaEnabled -bool false
$ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false

# ポップアップウィンドウをブロック
$ defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
$ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false

# 追跡を無効化
$ defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true

# 自動的に拡張機能を更新する
$ defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true

メール関連

# 送信と返信のアニメーションを無効にする
$ defaults write com.apple.mail DisableReplyAnimations -bool true
$ defaults write com.apple.mail DisableSendAnimations -bool true

# インライン添付ファイルの無効化
$ defaults write com.apple.mail DisableInlineAttachmentViewing -bool true

# 自動スペルチェックを無効化
$ defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled"

ターミナル関連

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

# iTermのダークテーマをインストール
$ open "${HOME}/init/Solarized Dark.itermcolors"

# ターミナル終了時のプロンプトを非表示にする
$ defaults write com.googlecode.iterm2 PromptOnQuit -bool false

App Store関連

# WebKitデベロッパーツールを有効にする
$ defaults write com.apple.appstore WebKitDeveloperExtras -bool true

# デバッグメニューを有効にする
$ defaults write com.apple.appstore ShowDebugMenu -bool true

# 自動更新チェックを有効にする
$ defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true

# 毎日アプリケーションのアップデートを確認する
$ defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

# アプリケーションのアップデートをバックグラウンドでダウンロードする
$ defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1

# システムデータファイルとセキュリティ更新プログラムをインストールする
$ defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1

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

# アプリケーションの自動更新を有効化
$ defaults write com.apple.commerce AutoUpdate -bool true

# 再起動が必要なアプリケーションの場合自動で再起動を有効化する
$ defaults write com.apple.commerce AutoUpdateRestartRequired -bool true

chrome関連

# トラックパッドの感度の悪いバックスワイプをすべて無効にする
$ defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
$ defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false

# システム固有の印刷プレビューダイアログを使用する
$ defaults write com.google.Chrome DisablePrintPreview -bool true
$ defaults write com.google.Chrome.canary DisablePrintPreview -bool true

# 既定で印刷ダイアログを展開する
$ defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true
$ defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true

まとめ

書いてみると意外とあった
dotfilesを作成してGitHubあたりで公開する予定です。

公開しました.
dotfiles/.macos

何かおススメの設定等あれば教えてください。

1671
1869
4

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
1671
1869