Skip to content

Instantly share code, notes, and snippets.

@yurakawa
Last active January 4, 2024 11:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurakawa/592b018bfbeeea99feee to your computer and use it in GitHub Desktop.
Save yurakawa/592b018bfbeeea99feee to your computer and use it in GitHub Desktop.
Setting up My Mac
#!/usr/bin/env bash
set -u
# --------------------
# Todo: Install xcode from App Store
# --------------------
# for System
defaults write com.apple.finder AppleShowAllFiles -bool YES # Show hidden files
defaults write com.apple.Dock showhidden -bool YES # Highlight hidden apps in the Dock
defaults write com.apple.desktopservices DSDontWriteNetworkStores true # Prevent .DS_Store from being created on network shares
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES # Display full posix path in Finder title bar
defaults write com.apple.finder QLEnableTextSelection -bool YES # Allow QuickLook to select text
defaults write -g ApplePressAndHoldEnabled -bool false
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -int 1
defaults write com.apple.dock orientation -string "left"
defaults write com.apple.dock magnification -bool true
defaults write com.apple.dock autohide -bool true
defaults write -g com.apple.keyboard.fnState -bool true
defaults write -g InitialKeyRepeat -int 13
defaults write -g KeyRepeat -int 3
## remap caps lock key to control (need os restart)
keyboard_id="$(ioreg -c AppleEmbeddedKeyboard -r | grep -Eiw "VendorID|ProductID" | awk '{ print $4 }' | paste -s -d'-\n' -)-0"
defaults -currentHost write -g com.apple.keyboard.modifiermapping.${keyboard_id} -array-add "
<dict>
<key>HIDKeyboardModifierMappingDst</key>\
<integer>30064771300</integer>\
<key>HIDKeyboardModifierMappingSrc</key>\
<integer>30064771129</integer>\
</dict>
"
killall Dock
killall Finder
# --------------------
# install requested for command line tool
# xcode-select --install || true
# sudo xcodebuild -license
# --------------------
# Install Homebrew and Xcode Command Line Tools
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/yurakawa/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# Update homebrew recipes
brew update
# --------------------
# Install GNU core utilities (those that come with OS X are outdated)
brew install coreutils
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
brew install findutils
# --------------------
PATH=$(brew --prefix coreutils)/libexec/gnubin:$PATH
#echo 'PATH=$(brew --prefix coreutils)/libexec/gnubin:$PATH' >> ~/.zprofile
source ~/.zprofile
# --------------------
binaries=(
direnv
git-secrets
graphicsmagick
webkit2png
rename
zopfli
ffmpeg
trash
diff-so-fancy
tree
ack
hub
git
wget
libmcrypt
# vim
macvim
bash-completion
openssl
rename
watch
awscli
exiftool
peco
ghq
gnu-sed
gnu-tar
grep
gzip
gawk
github/gh/gh
kubectl
google-cloud-sdk
go@1.18
tig
kubectx
fzf
protobuf
protoc-gen-go
protoc-gen-go-grpc
# cask
1password
bettertouchtool
karabiner-elements
clipy
deepl
macvim
google-chrome
google-drive
google-japanese-ime
iterm2
postman
skitch
slack
tableplus
wireshark
# handbrake
# kitematic
# mindnode-pro
postman
qlmarkdown
qlprettypatch
qlstephen
quicklook-json
scroll-reverser
skitch
slack
sourcetree
tableplus
# vlc
wireshark
meetingbar
adobe-acrobat-reader
)
echo "installing binaries..."
brew install ${binaries[@]}
# brew link
# brew link libxml2 --force
# brew link openssl --force
exec $SHELL -l
# --------------------
brew install --cask docker
brew cleanup
# --
ln -s $(brew --prefix macvim)/MacVim.app /Applications
# --------------------
# App storeより手動インストール
# --------------------
# settings for git
ln -s /usr/local/share/git-core/contrib/diff-highlight/diff-highlight /usr/local/bin
# --------------------
# setting for dotfiles
git clone https://github.com/yurakawa/dotfiles.git $HOME/dotfiles && cd ~/dotfiles && ./install
exec $SHELL -l
# ln -sf ~/Google\ Drive/memo ~/memo
# ln -sf ~/Google\ Drive/config/.ssh ~/.ssh
mkdir ~/.vim/{repos,tmp}
mkdir ~/go/src/github.com
# setup anyenv
git clone https://github.com/anyenv/anyenv ~/.anyenv
anyenv install --init
git clone https://github.com/znz/anyenv-update.git ~/.anyenv/plugins/anyenv-update
anyenv install rbenv
anyenv install phpenv
anyenv install pyenv
anyenv install nodenv
curl -L https://iterm2.com/shell_integration/install_shell_integration_and_utilities.sh | bash
go get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment