Skip to content

Instantly share code, notes, and snippets.

@ludoo0d0a
Forked from bradp/setup.sh
Last active October 18, 2021 04:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ludoo0d0a/d358debdcca08b953168588cf9302c2b to your computer and use it in GitHub Desktop.
Save ludoo0d0a/d358debdcca08b953168588cf9302c2b to your computer and use it in GitHub Desktop.
LudoO's Mac Setup Script
VERSION=1.0
EMAIL=my.name@yourmail.com
echo "Creating an SSH key for you..."
ssh-keygen -t rsa -b 4096 -C "$EMAIL"
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
# Update homebrew recipes
echo "Updating homebrew..."
brew update
echo "Installing Git..."
brew install git
echo "Git config"
git config --global user.name "LudoO"
git config --global user.email $EMAIL
git config --global github.user "ludoo0d0a"
echo "Cleaning up brew"
brew cleanup
# TODO: yadm
#echo "Copying dotfiles from Github"
#cd ~
#git clone git@github.com:bradp/dotfiles.git .dotfiles
#cd .dotfiles
#sh symdotfiles
# .bash_profile should exist first
echo "# My Bash profile" >> ~/.bash_profile
# NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bash_profile
# Latest stable Node
# nvm install --lts
nvm install 13
nvm alias default stable
nvm use default
node -v
npm install -g tldr typescript @vue/cli eslint gitbook-cli lodash
# Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k]
# https://gist.github.com/kevin-smets/8568070
# Install Zsh & Oh My Zsh
echo "Installing Oh My ZSH..."
curl -L http://install.ohmyz.sh | sh
echo "Setting up Oh My Zsh theme..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
echo "Setting up Oh My Zsh fonts..."
# Powerline fonts
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
cd ..
rm -rf fonts
cd
echo "Change iTerm2 font : Source Code Pro"
echo " (iTerm → Preferences → Profiles → Text → Change Font)"
#TODO : import my settings json
echo "Setting up Zsh plugins..."
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
echo "set values in ~/.zshrc:"
echo " ZSH_THEME=\"powerlevel10k/powerlevel10k\""
echo " plugins=(z git zsh-autosuggestions zsh-syntax-highlighting)"
echo "Manual Changes:"
echo " - Theme : Solarized Dark"
echo " - Use as default terminal"
echo " - Apply font size"
echo "For VisualStudio terminal, apply config https://gist.github.com/kevin-smets/8568070#visual-studio-code-config"
echo "Setting ZSH as shell..."
chsh -s /bin/zsh
# not used : mackup
brew install ack bat dockutil fd fzf geoip git-extras git-flow httpie http-server htop jq legit ncdu python-yq ripgrep ripgrep tldr trash tree wget yadm
# fzf: To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install
brew tap homebrew/cask-drivers
#brew tap federico-terzi/espanso
brew tap buo/cask-upgrade
# To update later, just >> brew cu
# jq companions: xq+yq are : https://github.com/kislyuk/yq (in python-yq)
# if issues , check conflicts in path :
# > whereis yq
# if required archive python version
# >mv ~/Library/Python/3.7/bin/xq ~/Library/Python/3.7/bin/_xq
# >mv ~/Library/Python/3.7/bin/yq ~/Library/Python/3.7/bin/_yq
# install Python3 stuff
curl https://bootstrap.pypa.io/get-pip.py | python3 -
pip3 install shallow-backup
# https://github.com/jaywcjlove/awesome-mac
# https://github.com/serhii-londar/open-source-mac-os-apps
# Apps installed with cask
# > brew list --cask > apps.cask.txt
apps=(
bitwarden
brooklyn
cakebrew
cleanmymac
cyberduck
diffmerge
#discord
docker
dozer
dupeguru
gimp
#gh
google-chrome
hex-fiend
iterm2
itsycal
jetbrains-toolbox
licecap
meetingbar
meld
postman
qlcolorcode
qlimagesize
qlmarkdown
qlstephen
qlvideo
quicklook-json
quicklookase
sourcetree
#spectacle
spotify
suspicious-package
synology-cloud-station-backup
textexpander
tiles
transmission
#vanilla
visual-studio-code
vlc
vorta
zoom
)
# Install apps to /Applications
# Default is: /Users/$user/Applications
echo "installing apps with Cask..."
brew install --cask --appdir="/Applications" ${apps[@]}
brew cleanup
# Android
# https://gist.github.com/patrickhammond/4ddbe49a67e5eb1b9c03
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
brew cask install adoptopenjdk11
cat <<'EOT' > ~/.javarc
jdk() {
version=$1
export JAVA_HOME=$(/usr/libexec/java_home -v"$version");
java -version
}
EOT
echo "source ~/.javarc" >> ~/.bash_profile
source ~/.bash_profile
jdk 8
java -version
# Android
brew install ant maven gradle
#Android-studio installed with jetbrains-toolbox
# brew cask install android-studio
brew cask install android-sdk
brew cask install android-ndk
brew cask install android-platform-tools
cat <<'EOT' > ~/.androidrc
export ANT_HOME=/usr/local/opt/ant
export MAVEN_HOME=/usr/local/opt/maven
export GRADLE_HOME=/usr/local/opt/gradle
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export ANDROID_HOME=$ANDROID_SDK_ROOT
export ANDROID_NDK_HOME=/usr/local/opt/android-ndk
export PATH=$ANT_HOME/bin:$PATH
export PATH=$MAVEN_HOME/bin:$PATH
export PATH=$GRADLE_HOME/bin:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/build-tools/19.1.0:$PATH
EOT
echo "source ~/.androidrc" >> ~/.bash_profile
source ~/.bash_profile
touch ~/.android/repositories.cfg
sdkmanager --update
sdkmanager "platform-tools" "platforms;android-29"
# Dart
brew tap dart-lang/dart
brew install dart
# Flutter
# https://flutter.dev/docs/get-started/install/macos
export FLUTTER_HOME=/usr/local/share/flutter-sdk
mkdir $FLUTTER_HOME
#cd $FLUTTER_HOME
#curl -o fl.zip https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_v1.12.13+hotfix.8-stable.zip
#unzip -q fl.zip
#rm fl.zip
# Flutter fvm
dart pub global activate fvm
echo "export ANDROID_HOME=/usr/local/share/android-sdk" >> ~/.bash_profile
cat <<'EOT' > ~/.flutterrc
export FLUTTER_HOME=/usr/local/share/flutter-sdk
# Flutter binaries
export PATH=$FLUTTER_HOME/flutter/bin:$PATH
# fvm binaries
export PATH=~/.pub-cache/bin:$PATH
EOT
echo "source ~/.flutterrc" >> ~/.bash_profile
source ~/.bash_profile
echo "Install sidekick from hhttps://github.com/leoafarias/sidekick/releases"
# Fvm sidekick
wget -o sidekick.dmg https://github.com/leoafarias/sidekick/releases#:~:text=sidekick-macos-0.1.1.dmg
open sidekick.dmg
rm sidekick.dmg
echo "install Flutter 2.2.3"
fvm install 2.2.3
flutter precache
flutter doctor --android-licenses
echo "Install XCode from MacStore"
read -p "Press [Enter] key when done..."
xcode-select --install
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
sudo xcodebuild -license
open -a Simulator
sudo gem install cocoapods
pod setup
# skia
# https://developer.android.com/studio/run/emulator-acceleration
#su
#setprop debug.hwui.renderer skiagl
#stop
#start
flutter doctor
# Finder extension: FinderPath
curl -o f.zip https://bahoom.com/finderpath/0.9.7/FinderPath.zip
unzip -q f.zip
mv FinderPath.app /Applications
rm f.zip
# Finder extension: open-in-buttons-for-finder-toolbar
git clone https://github.com/ludoo0d0a/open-in-buttons-for-finder-toolbar.git
cp -r open-in-buttons-for-finder-toolbar/apps/* /Applications
rm -rf open-in-buttons-for-finder-toolbar
# Finder : Show Hidden Files
defaults write com.apple.finder AppleShowAllFiles YES
# Trackpad reverse orientation
sudo defaults write com.apple.MultitouchSupport ForceAutoOrientation YES
#"Setting trackpad & mouse speed to a reasonable number"
defaults write -g com.apple.trackpad.scaling 2
defaults write -g com.apple.mouse.scaling 2.5
#"Allow text selection in Quick Look"
defaults write com.apple.finder QLEnableTextSelection -bool TRUE
#"Check for software updates daily, not just once per week"
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
#"Showing icons for hard drives, servers, and removable media on the desktop"
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
#"Showing all filename extensions in Finder by default"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
#"Disabling the warning when changing a file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
#"Use column view in all Finder windows by default"
defaults write com.apple.finder FXPreferredViewStyle Clmv
#"Avoiding the creation of .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
#"Enabling UTF-8 ONLY in Terminal.app and setting the Pro theme by default"
defaults write com.apple.terminal StringEncodings -array 4
defaults write com.apple.Terminal "Default Window Settings" -string "Pro"
defaults write com.apple.Terminal "Startup Window Settings" -string "Pro"
#"Disable the sudden motion sensor as its not useful for SSDs"
sudo pmset -a sms 0
#"Speeding up wake from sleep to 24 hours from an hour"
# http://www.cultofmac.com/221392/quick-hack-speeds-up-retina-macbooks-wake-from-sleep-os-x-tips/
sudo pmset -a standbydelay 86400
#"Disable annoying backswipe in Chrome"
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
#"Setting screenshots location to ~/Desktop"
defaults write com.apple.screencapture location -string "$HOME/Desktop"
#"Setting screenshot format to PNG"
defaults write com.apple.screencapture type -string "png"
#"Enabling the Develop menu and the Web Inspector in Safari"
defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" -bool true
#"Adding a context menu item for showing the Web Inspector in web views"
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# Dock
# https://github.com/joeyhoer/starter/blob/master/system/dock.sh
# dockutil --remove 'Safari'
#defaults write com.apple.dock tilesize -int 20; killall Dock
killall Finder
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment