Apple Siliconでの環境構築メモ

Brave
Slack(App Storeからいれてみた)
RunCat(かわいい)
MeetingBar → Notion Calenderが代替になった
ミーティングの時間になったら教えてくれたり今日のミーティング一覧みれるやつ

VSCode
「Apple Silicon」というボタンからダウンロードする

brewいれる
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Next stepで指示される操作をする
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/n04h/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
ちぇっく
brew -v

gitをbrewからinstallしたものを使う
→ brewでアップデート管理したほうがやりやすいため
brew install git
標準でMacに入っているgitは使わないようにさせる
echo 'export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"' >> /Users/n04h/.zprofile
git --version
git version 2.30.1 (Apple Git-130)
的な感じで表示されなくなればOK

Dockerインストール
ちゃんとApple Chipってのがあった(Siliconでは?)
そしてまだRosettaを使わないと対応してない箇所があるんだとか(結局使うのね...)
現状以下コマンドは使わなくてもよくなったはず
softwareupdate --install-rosetta

Spotify
一応対応しているみたい?

fishをbrew経由で入れる
brew install fish
ちぇっく
fish -v
場所確認
which fish
/etc/shells
に/opt/homebrew/bin/fish
を追記してデフォルトシェル変更
echo /opt/homebrew/bin/fish | sudo tee -a /etc/shells
chsh -s /opt/homebrew/bin/fish
ターミナル再起動
zshに設定していたやつをfishにもおこなう
echo 'eval (/opt/homebrew/bin/brew shellenv)' >> ~/.config/fish/config.fish
echo 'set PATH "/opt/homebrew/bin:/usr/local/bin:$PATH"' >> ~/.config/fish/config.fish

fisherいれる
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
ちぇっく
fisher -v

asdfいれる
brew install asdf
ぱすとおす
echo -e "\nsource "(brew --prefix asdf)"/libexec/asdf.fish" >> ~/.config/fish/config.fish
nodejsいれてみる
asdf plugin add nodejs
installしようとしたらgpg必要っていうので入れて再度
brew install gpg
asdf install nodejs 16.13.0
asdf global nodejs 16.13.0
node -v
npm -v
できた

Starshipのインストール
brew install starship
echo -e "\nstarship init fish | source" >> ~/.config/fish/config.fish

フォントをインストール
brew で入れられるとのこと
brew tap homebrew/cask-fonts
brew install font-fira-code

GitHub CLI で GitHub にログイン
brew install gh
gh auth login
GPG設定
brew install gpg pinentry-mac

ghqあたりも同じ
Homebrewありがとう

OpenVPNクライアント
AppleSilicon対応してた

asdfでmysqlのclientを使いたい
Xcodeもいれて以下実行
brew install gcc xz
asdf plugin add mysql
asdf list all mysql
asdf install mysql 8.0.27

Javaの環境構築
asdf plugin add java
asdf lista all java | grep 17
asdf install java openjdk-17.0.1
asdf global java openjdk-17.0.1

yarnいれる
asdf plugin-add yarn
asdf list-all yarn
asdf install yarn 1.22.17
asdf global yarn 1.22.17

GitKrakenもついに対応!

Rustを入れる
まんま書いてある通りに実行
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
パスを通す
set -U fish_user_paths $fish_user_paths $HOME/.cargo/bin
コマンド叩けるかチェック
rustc --version

iTermを入れる
設定とか

コマンドパレット(Command + Shift + P)でpath
と入れてVSCodeのシェルコマンドのパスを通す

画面分割アプリ

GitHubにSSHできるようにする
ssh-keygen -t ed25519 -C "youremail@example.com" // GitHubのemailを設定
// Enter file in which to save the key ... は githubを設定
vi ~/.ssh/config // 以下設定
Host github github.com
HostName github.com
IdentityFile ~/.ssh/github
User git
ssh git@github.com
以下出力されれば問題ないかな?
PTY allocation request failed on channel 0
Hi n04h! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

Google Cloud SDK を Homebrew を使って入れる
brew install google-cloud-sdk

Flutter
Apple Silicon 用のSDKをダウンロードして以下
cd ~
mkdir development
cd development
unzip ~/Downloads/flutter_macos_arm64_3.3.10-stable.zip
# fish使ってるので以下
set -U fish_user_paths $fish_user_paths $HOME/development/flutter/bin
# 使えるかチェック
flutter --version
# どくたー
flutter doctor
以下ダメ出しされた
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[!] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
Android toolchain については以下記事で対応できた
あとはライセンスに同意
flutter doctor --android-licenses
Xcode は記載されているコマンドを実行したらなおた
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Flutter SDK のバージョン管理をする asdf の plugin を入れる
asdf plugin-add flutter
asdf list all flutter
asdf install flutter 3.7.0-stable
asdf local flutter 3.7.0-stable
Dartもやるべきなのかな?とりあえず保留

asdfでできたプラグインのエコシステムをそのままつかえるとのこと
とりあえず今使っているやつのリスト確認
asdf list
fishのconfigからasdfを削除しておく
source /opt/homebrew/opt/asdf/libexec/asdf.fish
Homebrewでインストール
brew install mise
fishのconfigに以下追記
mise activate fish | source
mise hook-env -s fish | source # プラグインのパスを追加する
mise complete -s fish | source
これでシェルをリロードしてみると、globalに設定していたやつないよと警告が出たので、
以下実行してみる
mise i # install の alias
これでとりあえずglobalなやつはインストールできた
さよならasdf👋
brew uninstall asdf
追記
rubyの最新版がなかったが、プラグインを更新することで解決
mise plugins update ruby

ruby入れる時
To eliminate this warning, please install libyaml and reinstall your ruby.
とエラーになったので
brew install libyaml
実行して再インストールしたらできた

Notion いれる

ランチャーツールのRaycast

AWS CLI v2 を brewで入れる
brew install awscli
Session ManagerのPluginもbrewで
brew install --cask session-manager-plugin

Docker Desktopよりパフォーマンスが良いとのこと
ここみてbrewでインストール
brew install orbstack

❯ orb version
Version: 0.12.0 (120000)
Commit: 6e3826111e0aedbe7f5b3b8a1a12c969ba087ccd (v0.12.0)
❯ docker context ls
NAME TYPE DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default moby Current DOCKER_HOST based configuration unix:///var/run/docker.sock
desktop-linux * moby Docker Desktop unix:///Users/<username>/.docker/run/docker.sock
contextふえてない
helpみたらorb
とそのまま打てるコマンドがあるみたいなので実行したらウィンドウ開いて
Dockerの選択肢を押したらダッシュボード出てきた
かわってた
❯ docker context ls
NAME DESCRIPTION DOCKER ENDPOINT ERROR
default Current DOCKER_HOST based configuration unix:///var/run/docker.sock
desktop-linux Docker Desktop unix:///Users/<username>/.docker/run/docker.sock
orbstack * OrbStack unix:///Users/<username>/.orbstack/run/docker.sock

Wiresharkのインストール
「macOS Arm Disk Image」からダウンロードしてインストール

curlの代替として使うxhをインストール
brew install xh

スクショアプリ

mitmproxy
HTTPSのプロキシツール
brew install --cask mitmproxy

1Password
アプリ
CLI
Homebrewでインストール
brew install 1password-cli
SSH系の設定
コミット署名
上記手順だけだと以下エラーが出る
error: gpg.ssh.allowedSignersFile needs to be configured and exist for ssh signature verification
なので署名を許可するリストファイルを用意してあげる
git config --global gpg.ssh.allowedSignersFile ~/.ssh/git/allowed_signers
cd ~/.ssh
mkdir git
touch ./git/allowed_signers
echo 'hoge@example.com ssh-ed25519 <ハッシュ値>' > ./git/allowed_signers