Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
macOS Sierra 自分なりの環境構築スクリプト(通しで走らせたことがないので動くかは不明)
# Xcode
xcode-select --install
# HomeBrew
/usr/bin/ruby -e "$(curl -fsSL"
brew install p7zip git wget bash-completion vim subversion
# HomeBrew Cask
brew tap caskroom/cask
brew cask install caskroom/versions/google-chrome-beta chromium firefox visual-studio-code google-japanese-ime docker-edge fork filezilla transmit skype adobe-creative-cloud avocode microsoft-office dropbox scroll-reverser istat-menus kodi amazon-music
# Adobe CC インストーラーを起動
open -a /usr/local/Caskroom/adobe-creative-cloud/latest/Creative\ Cloud\
# Git の設定
read -p "git global " gitName
git config --global $gitName
read -p "git global " gitEmail
git config --global $gitEmail
git config --global core.quotepath false
# 共通設定
defaults write NSGlobalDomain -bool true
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 35
defaults write NSGlobalDomain AppleAquaColorVariant -int 6
defaults write NSGlobalDomain AppleHighlightColor -string "1.000000 0.733333 0.721569";
defaults write NSGlobalDomain AppleInterfaceStyle -string "Dark"
# メニューバーの設定
defaults write DateFormat -string "M\u6708d\u65e5(EEE) H:mm:ss"
# Dock の設定
defaults write tilesize -int 45
defaults write magnification -bool yes
defaults write largesize -int 75
defaults write wvous-br-corner -int 4
killall Dock
# Finder の設定
defaults write AppleShowAllFiles true
defaults write FXPreferredViewStyle Nlsv
defaults write _FXShowPosixPathInTitle -bool true
defaults write ShowStatusBar -bool true
defaults write ShowPathbar -bool true
defaults write _FXSortFoldersFirst -bool true
chflags nohidden ~/Library
killall Finder
# スクリーンショットの設定
# デフォルトディレクトリの変更
defaults write location ~/Pictures/
# 影をつけない
defaults write disable-shadow -boolean true
killall SystemUIServer
# ショートカット関連
# 全体 やり直し: cmd+Y 置換: cmd+H
defaults write "Apple Global Domain" NSUserKeyEquivalents -dict "\U3084\U308a\U76f4\U3057" "@y" "\U7f6e\U63db" "@h"
# Chrome 次を検索: F3 前を検索: shift+F3 デベロッパー ツール: F12 ソースを表示: cmd+U
defaults write NSUserKeyEquivalents -dict "\U30bd\U30fc\U30b9\U3092\U8868\U793a" "@u" "\U30c7\U30d9\U30ed\U30c3\U30d1\U30fc \U30c4\U30fc\U30eb" "\Uf70f" "\U524d\U3092\U691c\U7d22" "$\Uf706" "\U6b21\U3092\U691c\U7d22" "\Uf706"
# 変換切り替え cmd+space
defaults write AppleSymbolicHotKeys -dict-add 60 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>32</integer><integer>49</integer><integer>1048576</integer></array><key>type</key><string>standard</string></dict></dict>"
defaults write AppleSymbolicHotKeys -dict-add 61 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>32</integer><integer>49</integer><integer>1310720</integer></array><key>type</key><string>standard</string></dict></dict>"
defaults write AppleSymbolicHotKeys -dict-add 64 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>32</integer><integer>49</integer><integer>524288</integer></array><key>type</key><string>standard</string></dict></dict>"
defaults write AppleSymbolicHotKeys -dict-add 65 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>65535</integer><integer>49</integer><integer>1572864</integer></array><key>type</key><string>standard</string></dict></dict>"
# Terminal
open "Pro custom.terminal"
defaults write "Default Window Settings" -string "Pro custom"
defaults write "Startup Window Settings" -string "Pro custom"
# HOME ENDキー、バックスラッシュ 円マークの挙動を変更
mkdir -p ~/Library/KeyBindings
cat << EOF > ~/Library/KeyBindings/DefaultKeyBinding.dict
"\UF729" = moveToBeginningOfLine:;
"\UF72B" = moveToEndOfLine:;
"$\UF729" = moveToBeginningOfLineAndModifySelection:;
"$\UF72B" = moveToEndOfLineAndModifySelection:;
"@\UF729" = moveToBeginningOfDocument:;
"@\UF72B" = moveToEndOfDocument:;
"¥" = ("insertText:", "\\\\");
"_" = ("insertText:", "\\\\");
"\$_" = ("insertText:", "_");
# その他の設定
# ネットワーク接続したディレクトリに.DS_Storeを作らない
defaults write DSDontWriteNetworkStores -bool true
# タップをクリックに
defaults write Clicking -bool true
# バッテリーパーセント表示
defaults write ShowPercent -string "YES"
# Bash の設定
cat << EOF > ~/.bash_profile
if [ "$TERM_PROGRAM" = "Apple_Terminal" ]; then
if [ -f ~/.bashrc ]; then
source ~/.bashrc
cat << EOF > ~/.bashrc
alias ls="ls -G"
alias vi="vim"
export LSCOLORS=exgxcxdxcxegedabagacad
if [ $UID -eq 0 ]; then
PS1="\[\033[31m\]\u@\h\[\033[00m\]:\[\033[01m\]\w\[\033[00m\]\\$ "
PS1="\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[00m\]\[\033[01m\]\[\033[00m\]\\$ "
for app in $(brew cask list);
do local latest="$(brew cask info "${app}" | awk 'NR==1{print $2}')";
local versions=($(ls -1 "/usr/local/Caskroom/${app}/.metadata/"));
local current=$(echo ${versions} | awk '{print $NF}');
if [[ "${latest}" = "latest" ]];
then echo "[!] ${app}: ${current} == ${latest}";
[[ "$1" = "-f" ]] && brew cask install "${app}" --force;
elif [[ "${current}" = "${latest}" ]];
then continue;
echo "[+] ${app}: ${current} -> ${latest}";
brew cask uninstall "${app}" --force;
brew cask install "${app}";
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
source ~/.bash_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.