勝手に独り読書会 - その06

mathiasbynens 先生著の .osx - 自分的 defaults バイブル” 勝手に感謝して読書会,6.

今回も,そう使わない機能ばかりなので ry spotlight も,
terminal も,
time machine も,
TextEdit にいたっては,ほんと,今回のためにはじめて起動したし :p

###############################################################################
# Spotlight                                                                   #
###############################################################################

# Hide Spotlight tray-icon (and subsequent helper)
#sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
### メニューバーの spotlight アイコンを非表示
# Disable Spotlight indexing for any volume that gets mounted and has not yet
# been indexed before.
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
### [システム環境設定],[Spotlight] の [プライバシー] シート > [Spotlight の検索から除外する場所]
### -> /Volume (外付けの記憶媒体等)

# Change indexing order and disable some file types
defaults write com.apple.spotlight orderedItems -array \
    '{"enabled" = 1;"name" = "APPLICATIONS";}' \
    '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
    '{"enabled" = 1;"name" = "DIRECTORIES";}' \
    '{"enabled" = 1;"name" = "PDF";}' \
    '{"enabled" = 1;"name" = "FONTS";}' \
    '{"enabled" = 0;"name" = "DOCUMENTS";}' \
    '{"enabled" = 0;"name" = "MESSAGES";}' \
    '{"enabled" = 0;"name" = "CONTACT";}' \
    '{"enabled" = 0;"name" = "EVENT_TODO";}' \
    '{"enabled" = 0;"name" = "IMAGES";}' \
    '{"enabled" = 0;"name" = "BOOKMARKS";}' \
    '{"enabled" = 0;"name" = "MUSIC";}' \
    '{"enabled" = 0;"name" = "MOVIES";}' \
    '{"enabled" = 0;"name" = "PRESENTATIONS";}' \
    '{"enabled" = 0;"name" = "SPREADSHEETS";}' \
    '{"enabled" = 0;"name" = "SOURCE";}'
### [システム環境設定],[Spotlight] の [検索結果] シート > リスト

# Load new settings before rebuilding the index
killall mds
### 無; mds (metadata server) をいったんヤル

# Make sure indexing is enabled for the main volume
sudo mdutil -i on /
### 無; ルートボリュームのインデックス生成処理
# Rebuild the index from scratch
sudo mdutil -E /
### 無; ルートボリュームのインデックス再生成処理


###############################################################################
# Terminal                                                                    #
###############################################################################

# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
### ターミナル,[エンコーディング]シート > リスト > chb[Unicode (UTF-8)]
### -> "オン"

# Use a modified version of the Pro theme by default in Terminal.app
open "$HOME/init/Mathias.terminal"
sleep 1 # Wait a bit to make sure the theme is loaded
defaults write com.apple.terminal "Default Window Settings" -string "Mathias"
defaults write com.apple.terminal "Startup Window Settings" -string "Mathias"
### ターミナル,[設定] シート > [プロファイル]
### -> [Pro]

# Enable “focus follows mouse” for Terminal.app and all X11 apps
# i.e. hover over a window and start typing in it without clicking first
#defaults write com.apple.terminal FocusFollowsMouse -bool true
#defaults write org.x.X11 wm_ffm -bool true
### 無; マウスオーバーしたウインドウを入力アクティブにする
### -> true (する)

###############################################################################
# Time Machine                                                                #
###############################################################################

# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
### (略)

# Disable local Time Machine backups
hash tmutil &> /dev/null && sudo tmutil disablelocal
### 無; ローカルスナップショット機能
### -> disable


###############################################################################
# Address Book, Dashboard, iCal, TextEdit, and Disk Utility                   #
###############################################################################

# Enable the debug menu in Address Book
defaults write com.apple.addressbook ABShowDebugMenu -bool true
### 無; addressbook のデバッグメニュー
### -> true (表示する)

# Enable Dashboard dev mode (allows keeping widgets on the desktop)
defaults write com.apple.dashboard devmode -bool true
### 無; Dashboard の開発モード
### -> true (表示する)

# Enable the debug menu in iCal (pre-10.8)
defaults write com.apple.iCal IncludeDebugMenu -bool true
### (略)

# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
### TextEdit,[環境設定] の [新規書類] > [フォーマット]
### -> rb[標準テキスト]

# Open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
### TextEdit,[環境設定] の [開く/保存] > 標準テキストファイルのエンコーディング > drl[ファイルを開くとき]
### TextEdit,[環境設定] の [開く/保存] > 標準テキストファイルのエンコーディング > drl[ファイルを保存するとき]
### -> rb[Unicode (UTF-8)]

# Enable the debug menu in Disk Utility
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
defaults write com.apple.DiskUtility advanced-image-options -bool true
### 無; ディスクユーティリティのデバッグメニュー
### -> true (表示する)

以上です.

メモ.

Disable Spotlight indexing for any volume that gets mounted and has not yet

# Disable Spotlight indexing for any volume that gets mounted and has not yet
# been indexed before.
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"

sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" やっていることは,上述の通りですが,「たぶんこうだろうな」と.
ちょっと自信なかったりする.

ヒントに参考にさせていただいた情報は以下.;

コマンドが "Exclusion" ということなんで "除外する" ということなのでしょう.

上述リストの一番最初のエントリーを見ると,どうやら ui を持っているらしい.
[システム環境設定],[Spotlight] の [プライバシー] シート.
ここの Spotlight の検索から除外する場所

ここでの文脈は目的とちょっと違う方向のものですが,扱っているポイントは同じなので...

要は,
spotlirght 検索処理の対象外にしたいアイテムがある場合,どうしたら? というお話.

そして,見ているうちにどうやら,気になってきた ".Spotlight-V100" というのは,
それを key にしてみると,なるほど.

spotlight が使うものらしい.

SpotlightのIndexなどが.Spotlight-V100以下のFolderに入っていて、このDatabaseを使ってSpotlightの検索をします。Indexを作り直すのもこのFolderの中を書き直します。

spotlight は密かに,勝手に,そして強制的にこの ".Spotlight-V100" を産み落としていく.

".Spotlight-V100" は,maxos だと見ての通りドットアイテム.
ふつー見えない.

なものだから,
os によっては,見えちゃうことがあり,
幾つかの qa 系サイトで「何か知らないディレクトリできちゃってるけど,これって要るの?」なコミュニケーションを目にする.

んで.
別に消してもよいようなものらしい.*1

Load new settings before rebuilding the index

# Load new settings before rebuilding the index
killall mds

mds って何ってとこ.

'metadata server' というものらしい.

mds(metadata server)とは、Spotlightの検索と索引を制御しているプロセスです。

Disable local Time Machine backups

# Disable local Time Machine backups
hash tmutil &> /dev/null && sudo tmutil disablelocal

一応.

ローカルスナップショット機能 というのは,;

Time Machineに指定したハードディスクが接続されていない時でも内蔵ハードディスク上にバックアップを作るローカルスナップショットという機能

初めて知りました.
ふーん...

はい,おしまい.

*1:自己責任で