Last active
August 28, 2022 16:43
-
-
Save b-durand/d03dc3d188990de4b6fe5470c99b8744 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Scroll direction: natural | |
defaults write 'Apple Global Domain' com.apple.swipescrolldirection -bool FALSE | |
# Set the timezone | |
sudo systemsetup -settimezone "Europe/Paris" > /dev/null | |
# Require password immediately after sleep or screen saver begins | |
#defaults write com.apple.screensaver askForPasswordDelay -int 0 | |
# Icon size of Dock items | |
defaults write com.apple.dock tilesize -int 32 | |
# Dock magnification | |
defaults write com.apple.dock magnification -bool TRUE | |
# Top left screen corner | |
defaults write com.apple.dock wvous-tl-corner -int 10 | |
defaults write com.apple.dock wvous-tl-modifier -int 10 | |
# TODO Enable Night Shift | |
# Install Homebrew | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew update | |
brew install php composer git bash bash-completion jsonpp htop firefox google-chrome meteorologist menumeters spotify phpstorm homebrew/cask/docker sequel-ace slack visual-studio-code | |
# TODO Defines Chrome as default browser | |
# Remove all app icons from Dock | |
defaults write com.apple.dock persistent-apps -array | |
# Add my app icons | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Firefox.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Google Chrome.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Safari.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Slack.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Spotify.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/System/Applications/Utilities/Terminal.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/PhpStorm.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Visual Studio Code.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/System/Applications/Notes.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/System/Applications/System Preferences.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>" | |
killall Dock | |
# Show percent for battery | |
defaults write com.apple.menuextra.battery ShowPercent -string "YES" | |
# Use plain text mode for new TextEdit documents | |
defaults write com.apple.TextEdit RichText -int 0 | |
# Enable Secure Keyboard Entry in Terminal.app | |
defaults write com.apple.terminal SecureKeyboardEntry -bool true | |
defaults write com.apple.terminal Shell -string "$(brew --prefix)/bin/bash" | |
# MenuMeters | |
defaults write com.yujitach.MenuMeters CPUAverageMultiProcs -int 1 | |
defaults write com.yujitach.MenuMeters CPUPercentDisplayMode -int 2 | |
defaults write com.yujitach.MenuMeters DiskImageSet -int 4 | |
defaults write com.yujitach.MenuMeters MemDisplayMode -int 1 | |
defaults write com.yujitach.MenuMeters NetDisplayMode -int 2 | |
# TODO Set orders (from left to right): network, memory, CPU, and disk | |
# Meteorologist | |
defaults write com.heat.Meteorologist city -string "Paris, FR" | |
defaults write com.heat.Meteorologist displayCity -string "Paris" | |
defaults write com.heat.Meteorologist degreesUnit -int 1 | |
defaults write com.heat.Meteorologist displayDegreeType -int 1 | |
defaults write com.heat.Meteorologist displayHumidity -int 0 | |
defaults write com.heat.Meteorologist distanceUnit -int 2 | |
defaults write com.heat.Meteorologist speedUnit -int 1 | |
defaults write com.heat.Meteorologist useNewWeatherIcons -int 0 | |
# Spotify | |
defaults write com.spotify.client AutoStartSettingIsHidden -int 0 | |
# The bash completion for docker-compose is missing from Homebrew | |
sudo curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose --version | sed -E 's/^.* ([0-9]+\.[0-9]+\.[0-9]+).*$/\1/')/contrib/completion/bash/docker-compose -o $(brew --prefix)/etc/bash_completion.d/docker-compose | |
# bash | |
echo '[[ -s ~/.bashrc ]] && source ~/.bashrc' > ~/.bash_profile | |
curl -sL https://gist.github.com/b-durand/342e34be063cb27a54e959cce1e934a2/raw --output ~/.bashrc | |
# Configure vim | |
curl -sL https://gist.github.com/b-durand/d7e382ebe3e07e4f7b785a2d18925cf4/raw --output ~/.vimrc | |
# Configure git | |
curl -sL https://gist.github.com/b-durand/3287832/raw --output ~/.gitconfig | |
echo -n "Enter your name and press [ENTER]: " | |
read -t 10 name || name="John Doe" | |
git config --global user.name $name | |
echo -n "Enter your email and press [ENTER]: " | |
read -t 10 email || email="john.doe@link-value.fr" | |
git config --global user.email $email | |
cat > ~/.gitignore_global <<- EOF | |
# PhpStorm | |
.idea/ | |
EOF | |
git config --global core.excludesfile "~/.gitignore_global" | |
mkdir ~/git | |
# Adding a new SSH key to GitHub/GitLab | |
ssh-keygen -t ed25519 -C $email | |
eval "$(ssh-agent -s)" | |
cat > ~/.ssh/config <<- EOF | |
Host * | |
AddKeysToAgent yes | |
UseKeychain yes | |
IdentityFile ~/.ssh/id_ed25519 | |
EOF | |
ssh-add -K ~/.ssh/id_ed25519 | |
cat ~/.ssh/id_ed25519.pub | pbcopy | |
open -a "Google Chrome" https://github.com/settings/ssh/new | |
# Display changelogs after each composer update | |
composer global require "pyrech/composer-changelogs" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment