Skip to content

Instantly share code, notes, and snippets.

@MH4GF
Last active June 30, 2023 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MH4GF/83cd437393caa30afb3ea48807320f03 to your computer and use it in GitHub Desktop.
Save MH4GF/83cd437393caa30afb3ea48807320f03 to your computer and use it in GitHub Desktop.
#!/bin/sh
ARCH=$(uname -m)
xcode-select --install
echo "Homebrewがなければインストール"
if [ ! -x "`which brew`" ]; then
echo "ないのでインストール始めます"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# M1の場合pathを通す必要がある
if [ $ARCH == "arm64" ]; then
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
brew update
brew upgrade
brew -v
fi
brew doctor
echo "BrewfileをGistから取得する"
curl -fsSL https://gist.githubusercontent.com/MH4GF/c945f8e7654dcf1db7a2928885068167/raw > ~/.Brewfile
echo "brewで各ソフトウェアをインストール"
brew bundle --global
echo "1Password CLIのセットアップ"
eval $(op signin)
echo "秘匿ファイルを1Passwordからコピー"
mkdir -p ~/.aws
op item get .aws/config --fields label=notesPlain --format json | jq -r '.value' > ~/.aws/config
op item get .aws/credentials --fields label=notesPlain --format json | jq -r '.value' > ~/.aws/credentials
echo "Dotfilesをcloneしてきてシンボリックリンクを貼る"
ghq get --update git@github.com:MH4GF/dotfiles.git
~/ghq/github.com/MH4GF/dotfiles/setup.sh
# asdf
cut -d' ' -f1 .tool-versions | grep "^[^\#]" | xargs -I {} asdf plugin add {} || true
asdf install
# Finder
## ~/Library ディレクトリを見えるようにする
chflags nohidden ~/Library
## /Volumes ディレクトリを見えるようにする
chflags nohidden /Volumes
## ブート時のサウンドを無効化する
nvram SystemAudioVolume=" "
## 隠しファイルを表示する
defaults write com.apple.finder AppleShowAllFiles TRUE
## 全ての拡張子のファイルを表示
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
## 検索時にデフォルトでカレントディレクトリを検索
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# ⌘ + Q での終了を許可
defaults write com.apple.finder QuitMenuItem -bool true
killall Finder
# キーリピート
defaults write InitialKeyRepeat -int 12
defaults write KeyRepeat -int 1
# VSCode
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
## 代用文字入力をオフに
defaults write -g ApplePressAndHoldEnabled -bool false
# Dock に標準で入っているFinder とごみ箱以外の全てのアプリを消す
defaults write com.apple.dock persistent-apps -array
# メニューバー
## 各種表示
defaults write com.apple.systemuiserver menuExtras -array \
"/System/Library/CoreServices/Menu\ Extras/Bluetooth.menu" \
"/System/Library/CoreServices/Menu\ Extras/AirPort.menu" \
"/System/Library/CoreServices/Menu\ Extras/Volume.menu" \
"/System/Library/CoreServices/Menu\ Extras/Battery.menu" \
"/System/Library/CoreServices/Menu\ Extras/TextInput.menu" \
"/System/Library/CoreServices/Menu\ Extras/Clock.menu"
killall -kill SystemUIServer
default_apps=("GarageBand","Keynote","Pages","iMovie")
for default_app in ${default_apps[@]}; do
if [ -e /Applications/${default_app}.app ]; then
echo "${default_apps[@]}のアンインストール"
sudo rm -rf "/Applications/${default_app}.app"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment