-
-
Save OleksandrKucherenko/e76220f22359e0e49c81c5474b1457a1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash | |
set -x # uncomment to debug | |
# required for Homebrew | |
xcode-select —-install | |
sudo xcodebuild -license accept | |
# install https://brew.sh/ | |
which brew || (/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" ) | |
# install latest bash | |
if [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then | |
brew install bash | |
else | |
echo "[info] detected BASH version: ${BASH_VERSION}" | |
fi | |
# Include cask software packages | |
# Not needed any more, outdated: brew tap caskroom/cask | |
# install iTerm2 | |
brew install iterm2 --cask | |
# install ZSH | |
which zsh || (brew install zsh) | |
# install latest GIT | |
brew install git | |
brew install git-lfs | |
# install oh-my-zsh | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
# ZSH fast-syntax-highlighting | |
# deprecated: git clone https://github.com/zdharma/fast-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting | |
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git \ | |
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting | |
# ZSH autosuggestions, https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
# make ZSH default shell | |
sudo sh -c "echo $(which zsh) >> /etc/shells" && chsh -s $(which zsh) | |
# install powerline fonts (https://github.com/powerline/fonts/#quick-installation) | |
mkdir ~/workspace | |
git clone https://github.com/powerline/fonts.git --depth=1 ~/workspace/fonts | |
~/workspace/fonts/install.sh | |
# show file system as tree in terminal | |
which tree || (brew install tree) | |
# `cat` replacer | |
which bat || (brew install bat) | |
# expect, simualte user input in scripts | |
which expect || (brew install expect) | |
# RIP grep | |
which rg || (brew install ripgrep) | |
# https://formulae.brew.sh/formula/midnight-commander | |
which mcedit || (brew install midnight-commander) | |
# https://github.com/tldr-pages/tldr | |
which tldr || (brew install tldr) | |
# https://formulae.brew.sh/formula/htop | |
which htop || (brew install htop) | |
# https://formulae.brew.sh/formula/tmux | |
which tmux || (brew install tmux) | |
# JSON, https://formulae.brew.sh/formula/jq | |
which jq || (brew install jq) | |
# Yaml, https://github.com/mikefarah/yq | |
which yq || (brew install yq) | |
# Nano editor, https://www.nano-editor.org/ | |
which nano || (brew install nano) | |
# https://formulae.brew.sh/formula/watchman | |
which watchman || (brew install watchman) | |
# https://formulae.brew.sh/formula/watch, https://www.geeksforgeeks.org/watch-command-in-linux-with-examples/ | |
which watch || (brew install watch) | |
# PipeViewer, https://www.ivarch.com/programs/pv.shtml | |
which pv || (brew install pv) | |
# Gnu-Sed, https://www.gnu.org/software/sed/ | |
which gsed || (brew install gsed) | |
# https://command-not-found.com/whiptail | |
brew install newt | |
# instal NVM | |
which nvm || (curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash) | |
nvm install --lts | |
nvm use --lts | |
# install YVM | |
#which yvm || (brew install tophat/bar/yvm) | |
which yvm || (curl -s https://raw.githubusercontent.com/tophat/yvm/master/scripts/install.js | node) | |
yvm list-remote | |
# install direnv | |
which direnv || (curl -sfL https://direnv.net/install.sh | bash) | |
direnv allow | |
# install RVM, https://rvm.io/rvm/install | |
which rvm || (curl -sSL https://get.rvm.io | bash -s stable --ruby) | |
# install LastPass | |
brew install lastpass --cask | |
# diff tools | |
brew install p4v --cask | |
# p4merge, as GIT default merge tool... https://gist.github.com/tony4d/3454372 | |
git config --global merge.tool p4mergetool | |
git config --global mergetool.p4mergetool.cmd "/Applications/p4merge.app/Contents/Resources/launchp4merge \$PWD/\$BASE \$PWD/\$REMOTE \$PWD/\$LOCAL \$PWD/\$MERGED" | |
git config --global mergetool.p4mergetool.trustExitCode false | |
git config --global mergetool.keepBackup false | |
#brew install kdiff3 | |
# GIT UI | |
brew install fork --cask | |
# install messangers | |
brew install --cask slack | |
brew install --cask zoom | |
brew install --cask telegram-desktop | |
brew install --cask skype | |
brew install --cask microsoft-teams | |
brew install --cask discord | |
# install alternative browser | |
brew install google-chrome --cask | |
# Extensions: | |
# LastPass: https://chrome.google.com/webstore/detail/lastpass-free-password-ma/hdokiejnpimakedhajhdlcegeplioahd?hl=en-GB | |
# LanguageTool: https://chrome.google.com/webstore/detail/grammar-and-spell-checker/oldceeleldhonbafppcapldpdifcinji?hl=en-GB | |
# Grammarly: https://chrome.google.com/webstore/detail/grammarly-for-chrome/kbfnbcaeplbcioakkpcpgfkobkghlhen?hl=en-GB | |
# ImTranslator: https://chrome.google.com/webstore/detail/imtranslator-translator-d/noaijdpnepcgjemiklgfkcfbkokogabh?hl=en-GB | |
# AdsBlock: https://getadblock.com/ | |
brew install firefox --cask | |
/Applications/Firefox.app/Contents/MacOS/firefox https://addons.mozilla.org/en-US/firefox/addon/lastpass-password-manager/ & | |
# https://github.com/AdoptOpenJDK/homebrew-openjdk | |
# brew tap AdoptOpenJDK/openjdk | |
# brew install adoptopenjdk11 --cask | |
brew install --cask temurin | |
# install extra fonts | |
brew tap homebrew/cask-fonts | |
brew install font-fira-code --cask | |
brew tap colindean/fonts-nonfree | |
brew install font-microsoft-office --cask | |
# install vscode | |
brew install visual-studio-code --cask | |
# install TextMate, https://formulae.brew.sh/cask/textmate | |
brew install textmate --cask | |
# Anydesk, https://formulae.brew.sh/cask/anydesk | |
brew install anydesk --cask | |
# cyberduck, https://cyberduck.io/ | |
brew install cyberduck --cask | |
# XnConvert, https://www.xnview.com/en/xnconvert/ | |
brew install xnconvert --cask | |
brew install imagemagick | |
brew install graphicsmagick | |
brew install ffmpeg | |
# Clipboard Manager, Multiple Clipboards | |
# Clipy, https://clipy-app.com/ | |
brew install clipy --cask | |
# https://maccy.app/, https://github.com/p0deje/Maccy | |
brew install maccy | |
# trolCommander, https://trolsoft.ru/en/soft/trolcommander | |
brew install trolcommander --cask | |
# Far Manager For Linux (works for MacOs), https://github.com/elfmz/far2l | |
brew install --cask far2l | |
# GitUp, https://gitup.co/ | |
brew install gitup --cask | |
# Kap, https://getkap.co/ | |
brew install kap --cask | |
# Keka, www.keka.io | |
brew install keka --cask | |
# Be Focused, https://xwavesoft.com/be-focused-pro-for-iphone-ipad-mac-os-x.html | |
# Windows manager | |
# Magnet, https://magnet.crowdcafe.com/index.html | |
# Penc, https://deniz.co/penc/ | |
brew install penc --cask | |
# Divvy, https://mizage.com/divvy/ | |
brew install divvy --cask | |
# Calendar, Time, https://www.mowglii.com/itsycal/ | |
# Use pattern: E | 'w'ww | d MMM, HH:mm:ss | |
brew install itsycal --cask | |
# Hex Fiend, https://ridiculousfish.com/hexfiend/, https://formulae.brew.sh/cask/hex-fiend | |
brew install hex-fiend --cask | |
# https://github.com/zsh-users/zsh-completions | |
# Android Logcat | |
brew install pidcat | |
# Androic Screen Copy tool, https://formulae.brew.sh/formula/scrcpy | |
brew instal scrcpy | |
# Screensaver | |
# https://fliqlo.com/#/screensaver | |
brew install fliqlo --cask | |
# Markdown editor, https://macdown.uranusjr.com/ | |
brew install macdown --cask | |
# https://objective-see.com/products/knockknock.html | |
brew install knockknock --cask | |
# manual actions | |
echo ' | |
plugins=(git colored-man-pages colorize pip python brew osx fast-syntax-highlighting zsh-autosuggestions) | |
' | |
# https://github.com/cnstntn-kndrtv/open-in-buttons-for-finder-toolbar | |
# Finder: Show hidden files | |
defaults write com.apple.finder AppleShowAllFiles YES | |
# Finder: Automatically open a new Finder window when a volume is mounted | |
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true | |
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true | |
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true | |
# Activity Monitor: Visualize CPU usage in the Activity Monitor Dock icon | |
defaults write com.apple.ActivityMonitor IconType -int 5 | |
# Temperature monitoring: https://beebom.com/how-check-cpu-temperature-mac/, https://fannywidget.com/ | |
brew install fanny | |
# Enable TouchID for terminal SUDO | |
# https://dev.to/equiman/how-to-use-macos-s-touch-id-on-terminal-5fhg | |
# https://unix.stackexchange.com/questions/99350/how-to-insert-text-before-the-first-line-of-a-file | |
sudo gsed -i '1i auth sufficient pam_tid.so' /etc/pam.d/sudo | |
# Configure environment ~/.zshrc | |
# https://www.appsdeveloperblog.com/how-to-set-java_home-on-mac/ | |
# | |
# List available: `/usr/libexec/java_home -V` | |
# | |
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) | |
export ANDROID_HOME=/usr/local/opt/android | |
export GRADLE_USER_HOME=/usr/local/opt/.gradle | |
export M2_HOME=/usr/local/opt/.m2 | |
# run in terminal | |
launchctl setenv JAVA_HOME $JAVA_HOME | |
launchctl setenv GRADLE_USER_HOME $GRADLE_USER_HOME | |
launchctl setenv M2_HOME $M2_HOME | |
launchctl setenv ANDROID_HOME $ANDROID_HOME | |
# configure Finder, src: https://github.com/mathiasbynens/dotfiles/blob/main/.macos | |
# Finder: show path bar | |
defaults write com.apple.finder ShowPathbar -bool true | |
# Keep folders on top when sorting by name | |
defaults write com.apple.finder _FXSortFoldersFirst -bool true | |
# Display full POSIX path as Finder window title | |
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true | |
# Show hidden files | |
defaults write com.apple.finder AppleShowAllFiles true | |
# Avoid creating .DS_Store files on network or USB volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true |
https://github.com/romkatv/powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
ref: https://medium.com/@ThisIsUpen/how-to-jump-between-words-in-iterm2-3c22eb5a25ef
- Click on iTerm2 and open “Preferences”
- Click on “Profiles”
- Select your profile from the left (in my case “Default”)
- Click on “Keys” tab
- Click “Key Mappings” tab
- Click the “Presets” dropdown and select “Natural Text Editing”
Commands
# list iTerm2 Global keys Mapping
defaults read com.googlecode.iterm2.plist GlobalKeyMap
defaults read-type com.googlecode.iterm2.plist GlobalKeyMap # Dictionary
#
# template
#
defaults write com.googlecode.iterm2.plist GlobalKeyMap -dict-add "Key" "Value"
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes"
# defaults write com.googlecode.iterm2.plist GlobalKeyMap -array-add "Key" "Value"
# defaults write com.googlecode.iterm2.plist "orientation" -string "right"
# defaults write com.googlecode.iterm2.plist "expose-animation-duration" -float 0.1
# <value> is one of:
# <value_rep>
# -string <string_value>
# -data <hex_digits>
# -int[eger] <integer_value>
# -float <floating-point_value>
# -bool[ean] (true | false | yes | no)
# -date <date_rep>
# -array <value1> <value2> ...
# -array-add <value1> <value2> ...
# -dict <key1> <value1> <key2> <value2> ...
# -dict-add <key1> <value1> ...
Keys
Refs:
❯ cat ~/workspace/iterm2-keys-configuration.itermkeymap
{
"Key Mappings":{
"0x9-0x40000":{"Action":32,"Text":""},
"0xf72b-0x100000":{"Action":4,"Text":""},
"0xf703-0x300000-0x7c":{"Version":1,"Action":11,"Text":"0x05","Label":""},
"0xf702-0x320000":{"Action":33,"Text":""},
"0xf701-0x300000":{"Action":6,"Text":""},
"0xf72d-0x100000":{"Action":8,"Text":""},
"0xf702-0x300000-0x7b":{"Version":1,"Action":11,"Text":"0x01","Label":""},
"0x7f-0x100000-0x33":{"Version":1,"Action":11,"Text":"0x15","Label":""},
"0x19-0x60000":{"Action":39,"Text":""},
"0xf700-0x300000":{"Action":7,"Text":""},
"0xf703-0x320000":{"Action":34,"Text":""},
"0xf72c-0x100000":{"Action":9,"Text":""},
"0xf703-0x280000-0x7c":{"Version":1,"Action":10,"Text":"f","Label":""},
"0xf729-0x100000":{"Action":5,"Text":""},
"0x7f-0x80000-0x33":{"Version":1,"Action":11,"Text":"0x17","Label":""},
"0xf72c-0x20000":{"Action":9,"Text":""},
"0xf702-0x280000-0x7b":{"Version":1,"Action":10,"Text":"b","Label":""},
"0xf72d-0x20000":{"Action":8,"Text":""}
},
"Touch Bar Items":{}
}
Refs:
You could install blueutil and SleepWatcher via homebrew and set a .sleep code to do /usr/local/bin/blueutil -p 0
when going to sleep mode.
To use SleepWatcher, make a shell script in your home directory named .sleep
and give it permission with the chmod command.
You also can do a .wake
code to turn bluetooth back on with blueutil -p 1
You can find out how to use sleepwatcher here
Refs:
- https://github.com/odlp/bluesnooze/
- https://www.bernhard-baehr.de/
- http://braumeister.org/formula/blueutil
- https://www.kodiakskorner.com/log/258
brew install sleepwatcher blueutil
echo "$(which blueutil) -p 0" > ~/.sleep
echo "$(which blueutil) -p 1" > ~/.wakeup
chmod 755 ~/.sleep ~/.wakeup
brew services restart sleepwatcher
Refs:
#!/bin/bash
# Start tmux or attach running session
# If you want to end session so that commands do not run in the background,
# you have to press Modifier-C before closing terminal, or individually
# quit each process. Modifier-C usually means Alt-C
# See tmux cheatsheet https://gist.github.com/MohamedAlaa/2961058
# Change to your needs, each project should have unique name
PROJECT="frontend-starter"
COMMAND[0]="npm run serve"
COMMAND[1]="npm run watch-less"
COMMAND[2]="npm run watch-js"
# Don't modify this
_INDEX=0
function run-command {
tmux send-keys -t "$PROJECT:0.$_INDEX" '' C-m
tmux send-keys -t "$PROJECT:0.$_INDEX" "$1" C-m
# Increase the pane counter(or whatever it is??)
_INDEX=$(($_INDEX + 1))
# Run splitw for each time but last
if [ "${#COMMAND[@]}" -ne "$_INDEX" ]; then
tmux splitw -t $PROJECT:0
fi
tmux select-layout -t $PROJECT:0 even-horizontal
}
# Check if tmux session already exists
tmux start-server\; has-session -t $PROJECT 2>/dev/null
if [ "$?" -eq 1 ]; then
# Session didn't exist so create the session
TMUX= tmux new-session -d -s $PROJECT -n main
for cmd in "${COMMAND[@]}"
do
echo $cmd
run-command "$cmd"
done
tmux select-pane -t $PROJECT:0.0
tmux select-window -t 0
# Add possible configuration here
# tmux set-option -t $PROJECT mouse-select-pane on
tmux bind-key -n M-c kill-session
tmux bind-key -n M-Up select-pane -U
tmux bind-key -n M-Down select-pane -D
tmux bind-key -n M-Left select-pane -L
tmux bind-key -n M-Right select-pane -R
fi
# Kill tmux session on exit
_trap_exit() { tmux kill-session -t $PROJECT; }
trap _trap_exit EXIT
if [ -z "$TMUX" ]; then
tmux -u attach-session -t $PROJECT
else
tmux -u switch-client -t $PROJECT
fi
Run multiple processes with output with the use of tmux
Refs:
Organize Tray Icons. Hide menu bar icons to give your Mac a cleaner look.
brew install --cask hiddenbar
- https://github.com/Mortennn/Dozer DEPRECATED!
brew install --cask dozer
https://apps.apple.com/us/app/otp-manager/id928941247 - OTP Manager (One Time Password) is an apple desktop tool that allows you to get OTP codes not from your phone but from a desktop in-tray app. It can be used for cases when needed two-stage verification in one of the services
Zero-latency Audio Loopback Driver: https://github.com/ExistentialAudio/BlackHole
brew install blackhole-16ch
OBS Studio: https://obsproject.com/
brew install --cask obs
OBS Plugins:
- https://github.com/GrandMastersOnline/obs-lottie/releases
- https://github.com/norihiro/obs-color-monitor/releases
- https://obsproject.com/forum/resources/audio-monitor.1186/
- https://obsproject.com/forum/resources/move-transition.913/
- https://obsproject.com/forum/resources/source-switcher.941/
- https://obsproject.com/forum/resources/ashmanix-countdown-timer.1610/
Draw on screen during presentation:
https://apps.apple.com/us/app/screenbrush/id1233965871?mt=12
DEPRECATED!
Install from App Store via Command Line command:
https://github.com/mas-cli/mas
brew install mas
# Amphetamine
mas install 937984704
mas info 937984704
Amphetamine 5.3 [0.0]
By: William Gustafson
Released: 2023-08-24
Minimum OS: 10.14.6
Size: 6,3 MB
From: https://apps.apple.com/se/app/amphetamine/id937984704?mt=12&uo=4
https://github.com/moretension/duti
UI: https://github.com/tsonglew/dutis
brew install duti
# get the default app for JPG files
duti -x jpg
# set the default app for bash SH files
duti -s com.microsoft.VSCode .sh all
ref: https://apple.stackexchange.com/questions/91522/change-file-association-in-terminal
https://github.com/jhspetersson/fselect - Find files with SQL-like queries
https://github.com/dalance/procs OR https://github.com/aristocratos/bpytop OR https://github.com/aristocratos/btop - OS Process Manager
https://github.com/acmesh-official/acme.sh - SSL certificates
https://github.com/ericchiang/pup - parse HTML in command line, extract data like jq
https://restic.net/#quickstart - backup drive/folder
configuration of MacOs via command line - https://git.herrbischoff.com/awesome-macos-command-line/about/
https://github.com/microsoft/cascadia-code
download binaries: https://github.com/microsoft/cascadia-code/releases
italic for keywords in VsCode: https://github.com/kosimst/FiraFlott , wesbos/cobalt2-vscode#116
display images inside iTerm2 - https://iterm2.com/documentation-one-page.html#documentation-images.html
https://github.com/liquidaty/zsv
Another good tool for processing CSV, TSV data
Far Manager For MacOS: https://github.com/elfmz/far2l
brew install --HEAD yurikoles/yurikoles/far2l
keybindings:
- corporateshark/far2l-macros#6
- elfmz/far2l#986
- https://github.com/corporateshark/far2l-macros/tree/master
create file ~/.config/far2l/settings/key_macros.ini
:
[KeyMacros/Shell/Esc]
DisableOutput=0x1
EmptyCommandLine=0x1
Sequence=CtrlO
[KeyMacros/Shell/Bs]
DisableOutput=0x1
EmptyCommandLine=0x1
Sequence=CtrlPgUp
[KeyMacros/Shell/NumEnter]
DisableOutput=0x1
EmptyCommandLine=0x1
Sequence=CtrlPgUp
[KeyMacros/Shell/CtrlNumEnter]
DisableOutput=0x1
EmptyCommandLine=0x1
Sequence=Ins
[KeyMacros/Menu/CtrlBrowserForward]
DisableOutput=0x1
Sequence=Ins
[KeyMacros/Menu/CtrlI]
DisableOutput=0x1
FilePanels=0x1
PluginPanels=0x1
Sequence=Ins
[KeyMacros/Editor/CtrlUp]
DisableOutput=0x1
Sequence=PgUp
[KeyMacros/Editor/CtrlDown]
DisableOutput=0x1
Sequence=PgDn
[KeyMacros/Editor/CtrlS]
DisableOutput=0x1
Sequence=F2
BUN
curl -fsSL https://bun.sh/install | bash
git clone https://github.com/lukechilds/zsh-nvm.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-nvm
+ export NVM_LAZY_LOAD=true
+ export NVM_COMPLETION=true
plugins+=(
+ zsh-nvm
)
- # NVM
- export NVM_DIR="$HOME/.nvm"
- [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
ref: https://blog.mattclemente.com/2020/06/26/oh-my-zsh-slow-to-load/
ref: https://github.com/mroth/evalcache
https://github.com/FiloSottile/mkcert
ref: https://stackoverflow.com/questions/26663404/webpack-dev-server-running-on-https-web-sockets-secure