#pragma section-numbers off
[[TableOfContents]]

= 概要 =
2023 Mac mini M2 をセットアップする時のメモ

最低限構成

ほとんどの開発をcloud上とか、リモートデスクトップとか、 Dockerとかで実施してしまうため、Macは最低限構成にしている

= 設定 =

== System Preferences ==
 * General
     * Show scroll bars: Always
    *  AirDrop and Handoff: Handoff を許可しない設定
 * Date & Time
     * Timezoneが適切か確認
     * Clock: 24時間表示、曜日表示等設定
 * Security & Privacy
    * アクセシビリティ
 * アクセスビリティ
    * ディスプレイ
         * ポインタ ー> カーソルサイズ(画面が大きいのでポインタ多少大きくいしている)
         * 透明度を下げる:壁紙によっては見づらいので、必要に応じて設定

== Terminal ==
  * Profiles
    * Cobalt2 https://github.com/pmchung/osx-terminal-themes/blob/master/schemes/Cobalt2.terminal に設定
    * Text -> Font Sizeを適当に設定
    * Windows -> Background -> Color & Effects -> Opacity を適当に設定
    * Adbanced -> Audible bell: OFF
    * ANSI Colorsを適当に設定

== Finder ==
 * Advanced
    * Show all filename extensions
    * Remove items from the Trash after 30 days
    * When perfoming a search: Search the Current Folder

== コマンドライン設定 ==

スクリーンショットの保存先の変更(デフォルトはデスクトップだが、デスクトップに保存されるのがいやなので)
{{{
defaults write com.apple.screencapture location ~/Pictures/
killall SystemUIServer
}}}

= フォント =
 * https://github.com/yuru7/Firge

= パッケージソフト =
brew で大概実施する感じで

 * ["Homebrew"]

= shell =

 * ["Zsh"]

= ソフト =
 * ["GoogleChrome"]
  * デフォルトブラウザにする
  * メニュー -> Chrome -> Warn before Quitting
 * ["ForkLift"] https://binarynights.com/
   * brew install --cask forklift
 * OmniFocus: https://www.omnigroup.com/omnifocus/
   * App Store
 * Notion: https://www.notion.so/
   * brew install --cask notion
 * ["CotEditor"]
   * brew install --cask coteditor
 * ["VSCode"]
   * brew install --cask visual-studio-code
 * Dropbox
  * brew install --cask dropbox
  * System Preferences -> Security & Privacy -> アクセスビリティ -> 有効
   * Dropboxフォルダの場所移動のための、アップグレードが要求されるので、フォルダ移動プロセスを完了する必要がある
 * AquaSKK
   * brew install --cask aquaskk
   * 再起動必要
 * Karabiner-Elements
   * brew install --cask karabiner-elements
   * 英数-> 左control
   * かな->return
 * CursorSense: https://plentycom.jp/cursorsense/
 * The Unarchiver
    * brew install --cask the-unarchiver
 * Lunar: https://lunar.fyi/  輝度調整したりする。必要と思う時とそうでもない時がある……。無料の範囲でしか利用していない
    * brew install --cask lunar

= ssh =
古い環境から鍵を移動した場合、うまく接続できない場合があります

.ssh/config の先頭に以下を追加

{{{
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
}}}

暫定対処になります。本来は鍵のバージョンアップが必要

これは MacのせいではなくOpenSSHの仕様変更による物です。つまり将来的にはすべての環境で発生する物です。鍵のバージョンアップをしておきましょう

OpenSSH 6.5以上に全環境が統一されている(バージョン確認は ssh -V)なら以下で生成すれば良い 

{{{
ssh-keygen -t ed25519
}}}

たまに未だに鍵長1024を利用している人がいますが、危険なのでやめた方がよいでしょう

= zsh =

zinit(一度トラブルがありましたが現状は安定しています)
{{{
bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
}}}

= Emacs =
すこし悩んだがbrewで入れた
{{{
brew tap railwaycat/emacsmacport
brew install emacs-mac

osascript -e 'tell application "Finder" to make alias file to POSIX file "/opt/homebrew/opt/emacs-mac/Emacs.app" at POSIX file "/Applications"'
}}}

 * キーボードショートカット
    * 入力ソース
        * 前回の入力ソースを選択: OFF

skk が release版だとエラーになる ccc.el を最新にする必要がある
  * https://raw.githubusercontent.com/skk-dev/ddskk/master/ccc.el

= Python =
{{{
git clone https://github.com/pyenv/pyenv.git ~/opt/pyenv
}}}

{{{
export PYENV_ROOT=${HOME}/opt/pyenv
export PATH=${PYENV_ROOT}/bin:${PATH}
eval "$(pyenv init -)"
}}}

{{{
pyenv install --list
}}}

すごく古いソースコードを解析したりする事があるので、2.7の最新版も入れているが、普通は利用していない。

3.6とかも特定の要件で利用している。
{{{
pyenv install -v 2.7.18
pyenv install -v 3.6.15
pyenv install -v 3.11.2
}}}

{{{
~/opt/pyenv/versions/3.11.2/bin/python3 -m venv ~/opt/py3.11
source ~/opt/py3.11/bin/activate
}}}

{{{
pip install --upgrade pip
pip install virtualenv
}}}

= ソフト(コマンドライン系)  =
 * https://github.com/wilx/apg : パスワードジェネレータ。パスワード生成の参考にたまに利用
 * nginx
 * rsync
     * brew install libiconv
     * brew install rsync
     * 古い情報だとtapを求めている情報がありますが不要です

= 参考サイト =
----
CategoryMac