backup.sh
· 3.9 KiB · Bash
Raw
#!/bin/bash
# Color Utilities
function green() { printf "\033[32m%s\033[0m\n\n" "$1"; }
function orange() { printf "\033[38;5;208m%s\033[0m\n" "$1"; }
function red() { printf "\033[91m%s\033[0m\n" "$1"; }
function blue() { printf "\033[38;5;27m%s\033[0m\n" "$1"; }
# Constants
BACKUP_DIR="$HOME/backups"
FILENAME="$BACKUP_DIR/$(date +%d_%m_%Y).tar"
# Create backup directory if it doesn't exist
function ensure_backup_dir() {
if [[ ! -e "$BACKUP_DIR" ]]; then
blue "Creating backup directory."
mkdir -p "$BACKUP_DIR"
fi
}
# Handle existing backup file
function check_existing_backup() {
if [[ -f "$FILENAME" ]]; then
orange "$FILENAME already exists!"
read -rp "Do you want to remove the existing backup file? (y/n) : " answer
[[ $answer == 'y' ]] && rm "$FILENAME" || exit 1
fi
}
function generate_config_files() {
green "Preparing iterm2 & brew config ..."
local brew_file="$HOME/Brewfile"
local iterm2_file="$HOME/iterm.itermexport"
brew bundle dump --force --file="$brew_file"
if [[ ! -f "$brew_file" ]]; then
orange "$brew_file doesn't exist!"
read -rp "Do you want to continue? (y/n): " answer
[[ "$answer" == "y" ]] || exit 1
fi
tar -rpf "$FILENAME" "$brew_file"
if [[ ! -f "$iterm2_file" ]]; then
orange "$iterm2_file doesn't exist!"
read -rp "Do you want to continue? (y/n): " answer
[[ "$answer" == "y" ]] || exit 1
fi
tar -rpf "$FILENAME" "$iterm2_file" && rm "$iterm2_file"
}
# Backup dotfiles
function backup_dotfiles() {
green "Backing up dotfiles..."
find "$HOME"/.* -maxdepth 0 -type f -exec tar -rpf "$FILENAME" {} +
}
# Exclude large config dirs and create gzipped archive of .config
function backup_config_gz() {
tar -rpf "$FILENAME" "$HOME/.config/git"
tar -rpf "$FILENAME" "$HOME/.config/rclone"
tar -rpf "$FILENAME" "$HOME/.config/telebit"
tar -rpf "$FILENAME" "$HOME/.config/yarn/global/package.json"
tar -rpf "$FILENAME" "$HOME/.gnupg/*.gpg"
tar -rpf "$FILENAME" "$HOME/.gradle/gradle.properties"
tar -rpf "$FILENAME" "$HOME/.android/debug.keystore"
}
# Append selected items to tar archive
function backup_specific_items() {
green "Backing up specific items..."
tar -rpf "$FILENAME" --exclude=".git" "$HOME/.zsh"
tar -rpf "$FILENAME" "$HOME/.ssh"
tar -rpf "$FILENAME" $HOME/Library/LaunchAgents/local.*
tar -rpf "$FILENAME" $HOME/Data/launchd/*/*.sh
tar -rpf "$FILENAME" "$HOME/Library/Developer/Xcode/UserData/KeyBindings"
tar -rpf "$FILENAME" --exclude="*.log" "$HOME/.aria2"
tar -rpf "$FILENAME" /etc/hosts /etc/paths
# tar -rpf "$FILENAME" /etc/postfix
# tar -rpf "$FILENAME" /etc/apache2/**/*.conf
}
# Backup command output (defaults, crontab, brew list)
function backup_system_state() {
crontab -l >crontab.txt && tar -rpf "$FILENAME" crontab.txt && rm crontab.txt
defaults read >defaults.txt && tar -rpf "$FILENAME" defaults.txt && rm defaults.txt
brew list >homebrew.txt && tar -rpf "$FILENAME" homebrew.txt && rm homebrew.txt
}
# Append list of backed-up files
function add_backup_log() {
{
echo "Save location: https://onedrive.live.com/?id=5FC8AF0024B02AE9%2118898&cid=5FC8AF0024B02AE9"
echo -e "\n\nBackup List:\n"
tar -tvf "$FILENAME"
} >backup_log.txt
tar -rpf "$FILENAME" backup_log.txt
rm backup_log.txt
}
# Validate final backup size
function validate_backup_size() {
local size size_mb
size=$(stat -f "%z" "$FILENAME")
size_mb=$(echo "scale=2; $size / 1024 / 1024" | bc)
blue "$FILENAME has size ${size_mb} MB"
if [[ $size -gt 24000000 ]]; then
red "Backup > 24 MB, aborting."
exit 1
else
green "Done!"
fi
}
# === Main Execution ===
ensure_backup_dir
check_existing_backup
cd "$HOME" || exit 1
generate_config_files
backup_dotfiles
backup_config_gz
backup_specific_items
backup_system_state
add_backup_log
validate_backup_size
exit 0
# Restore with:
# sudo tar -xvf <backup_filename>.tar -C /
# brew bundle install --file=~/Brewfile
| 1 | #!/bin/bash |
| 2 | |
| 3 | # Color Utilities |
| 4 | function green() { printf "\033[32m%s\033[0m\n\n" "$1"; } |
| 5 | function orange() { printf "\033[38;5;208m%s\033[0m\n" "$1"; } |
| 6 | function red() { printf "\033[91m%s\033[0m\n" "$1"; } |
| 7 | function blue() { printf "\033[38;5;27m%s\033[0m\n" "$1"; } |
| 8 | |
| 9 | # Constants |
| 10 | BACKUP_DIR="$HOME/backups" |
| 11 | FILENAME="$BACKUP_DIR/$(date +%d_%m_%Y).tar" |
| 12 | |
| 13 | # Create backup directory if it doesn't exist |
| 14 | function ensure_backup_dir() { |
| 15 | if [[ ! -e "$BACKUP_DIR" ]]; then |
| 16 | blue "Creating backup directory." |
| 17 | mkdir -p "$BACKUP_DIR" |
| 18 | fi |
| 19 | } |
| 20 | |
| 21 | # Handle existing backup file |
| 22 | function check_existing_backup() { |
| 23 | if [[ -f "$FILENAME" ]]; then |
| 24 | orange "$FILENAME already exists!" |
| 25 | read -rp "Do you want to remove the existing backup file? (y/n) : " answer |
| 26 | [[ $answer == 'y' ]] && rm "$FILENAME" || exit 1 |
| 27 | fi |
| 28 | } |
| 29 | |
| 30 | function generate_config_files() { |
| 31 | green "Preparing iterm2 & brew config ..." |
| 32 | |
| 33 | local brew_file="$HOME/Brewfile" |
| 34 | local iterm2_file="$HOME/iterm.itermexport" |
| 35 | |
| 36 | brew bundle dump --force --file="$brew_file" |
| 37 | |
| 38 | if [[ ! -f "$brew_file" ]]; then |
| 39 | orange "$brew_file doesn't exist!" |
| 40 | read -rp "Do you want to continue? (y/n): " answer |
| 41 | [[ "$answer" == "y" ]] || exit 1 |
| 42 | fi |
| 43 | |
| 44 | tar -rpf "$FILENAME" "$brew_file" |
| 45 | |
| 46 | if [[ ! -f "$iterm2_file" ]]; then |
| 47 | orange "$iterm2_file doesn't exist!" |
| 48 | read -rp "Do you want to continue? (y/n): " answer |
| 49 | [[ "$answer" == "y" ]] || exit 1 |
| 50 | fi |
| 51 | |
| 52 | tar -rpf "$FILENAME" "$iterm2_file" && rm "$iterm2_file" |
| 53 | } |
| 54 | |
| 55 | # Backup dotfiles |
| 56 | function backup_dotfiles() { |
| 57 | green "Backing up dotfiles..." |
| 58 | find "$HOME"/.* -maxdepth 0 -type f -exec tar -rpf "$FILENAME" {} + |
| 59 | } |
| 60 | |
| 61 | # Exclude large config dirs and create gzipped archive of .config |
| 62 | function backup_config_gz() { |
| 63 | tar -rpf "$FILENAME" "$HOME/.config/git" |
| 64 | tar -rpf "$FILENAME" "$HOME/.config/rclone" |
| 65 | tar -rpf "$FILENAME" "$HOME/.config/telebit" |
| 66 | tar -rpf "$FILENAME" "$HOME/.config/yarn/global/package.json" |
| 67 | |
| 68 | tar -rpf "$FILENAME" "$HOME/.gnupg/*.gpg" |
| 69 | tar -rpf "$FILENAME" "$HOME/.gradle/gradle.properties" |
| 70 | tar -rpf "$FILENAME" "$HOME/.android/debug.keystore" |
| 71 | } |
| 72 | |
| 73 | # Append selected items to tar archive |
| 74 | function backup_specific_items() { |
| 75 | green "Backing up specific items..." |
| 76 | tar -rpf "$FILENAME" --exclude=".git" "$HOME/.zsh" |
| 77 | tar -rpf "$FILENAME" "$HOME/.ssh" |
| 78 | tar -rpf "$FILENAME" $HOME/Library/LaunchAgents/local.* |
| 79 | tar -rpf "$FILENAME" $HOME/Data/launchd/*/*.sh |
| 80 | tar -rpf "$FILENAME" "$HOME/Library/Developer/Xcode/UserData/KeyBindings" |
| 81 | tar -rpf "$FILENAME" --exclude="*.log" "$HOME/.aria2" |
| 82 | tar -rpf "$FILENAME" /etc/hosts /etc/paths |
| 83 | # tar -rpf "$FILENAME" /etc/postfix |
| 84 | # tar -rpf "$FILENAME" /etc/apache2/**/*.conf |
| 85 | } |
| 86 | |
| 87 | # Backup command output (defaults, crontab, brew list) |
| 88 | function backup_system_state() { |
| 89 | crontab -l >crontab.txt && tar -rpf "$FILENAME" crontab.txt && rm crontab.txt |
| 90 | defaults read >defaults.txt && tar -rpf "$FILENAME" defaults.txt && rm defaults.txt |
| 91 | brew list >homebrew.txt && tar -rpf "$FILENAME" homebrew.txt && rm homebrew.txt |
| 92 | } |
| 93 | |
| 94 | # Append list of backed-up files |
| 95 | function add_backup_log() { |
| 96 | { |
| 97 | echo "Save location: https://onedrive.live.com/?id=5FC8AF0024B02AE9%2118898&cid=5FC8AF0024B02AE9" |
| 98 | echo -e "\n\nBackup List:\n" |
| 99 | tar -tvf "$FILENAME" |
| 100 | } >backup_log.txt |
| 101 | tar -rpf "$FILENAME" backup_log.txt |
| 102 | rm backup_log.txt |
| 103 | } |
| 104 | |
| 105 | # Validate final backup size |
| 106 | function validate_backup_size() { |
| 107 | local size size_mb |
| 108 | size=$(stat -f "%z" "$FILENAME") |
| 109 | size_mb=$(echo "scale=2; $size / 1024 / 1024" | bc) |
| 110 | blue "$FILENAME has size ${size_mb} MB" |
| 111 | |
| 112 | if [[ $size -gt 24000000 ]]; then |
| 113 | red "Backup > 24 MB, aborting." |
| 114 | exit 1 |
| 115 | else |
| 116 | green "Done!" |
| 117 | fi |
| 118 | } |
| 119 | |
| 120 | # === Main Execution === |
| 121 | ensure_backup_dir |
| 122 | check_existing_backup |
| 123 | cd "$HOME" || exit 1 |
| 124 | generate_config_files |
| 125 | backup_dotfiles |
| 126 | backup_config_gz |
| 127 | backup_specific_items |
| 128 | backup_system_state |
| 129 | add_backup_log |
| 130 | validate_backup_size |
| 131 | |
| 132 | exit 0 |
| 133 | |
| 134 | # Restore with: |
| 135 | # sudo tar -xvf <backup_filename>.tar -C / |
| 136 | # brew bundle install --file=~/Brewfile |
| 137 |
config.md
· 1.7 KiB · Markdown
Raw
## macos
- settings -> keyboard shortuts -> services -> disable searching
- settings -> keyboard shortuts -> mission control -> mission control {swtich to desktop nth}
- settings -> display -> {reduce motion,increase contrast}
- settings -> desktop & dock -> Mission control -> {diable rerrangement,separate spaces}
- settings -> desktop & dock -> Desktop & dock -> {diable animate application,recent apps}
- sudo mdutil -i off / -> disable spotlight indexing
## iterm
- settings -> profiles -> other actions -> import json as profile
- Settings -> Advanced -> Scroll wheel sends arrow keys when in alternate screen mode: FALSE
- Preferences → Profiles → Keys → Keyboard Behavior-> Natural Text Editing
## android studio
- tools -> create commandline launcher
- logcat -> ⚙️ -> modify views
- settings -> keymaps -> version control systems -> git -> Annotate = ctl + shf + b
- build -> build tools -> gradle -> enable parallel gradle model fetching
- Preferences -> Appearance & Behavior -> System Settings -> max
- commit -> ⋮ -> configure local change -> staging area
- commit -> 👁️ -> group by directory
## firefox
- about:preferences#privacy -> Firefox Data Collection and Use -> disable
- about:preferences#privacy -> Custom history -> Uncheck all
## mate
- view -> show file browser -> project folder -> (dropdown) use \* as project folder
- settings -> terminal -> shell support insatll
## vscode
- settings gui -> "search: exclude" -> add "\**/*lock.yaml"
- \> Install 'code' command in PATH" command
## zed
- /> cli: install cli binary
## dbeaver
- window -> show view -> query manager
## tailscale
https://login.tailscale.com/admin/machines -> Disable key expiry (trusted server)
macos
- settings -> keyboard shortuts -> services -> disable searching
- settings -> keyboard shortuts -> mission control -> mission control {swtich to desktop nth}
- settings -> display -> {reduce motion,increase contrast}
- settings -> desktop & dock -> Mission control -> {diable rerrangement,separate spaces}
- settings -> desktop & dock -> Desktop & dock -> {diable animate application,recent apps}
- sudo mdutil -i off / -> disable spotlight indexing
iterm
- settings -> profiles -> other actions -> import json as profile
- Settings -> Advanced -> Scroll wheel sends arrow keys when in alternate screen mode: FALSE
- Preferences → Profiles → Keys → Keyboard Behavior-> Natural Text Editing
android studio
- tools -> create commandline launcher
- logcat -> ⚙️ -> modify views
- settings -> keymaps -> version control systems -> git -> Annotate = ctl + shf + b
- build -> build tools -> gradle -> enable parallel gradle model fetching
- Preferences -> Appearance & Behavior -> System Settings -> max
- commit -> ⋮ -> configure local change -> staging area
- commit -> 👁️ -> group by directory
firefox
- about:preferences#privacy -> Firefox Data Collection and Use -> disable
- about:preferences#privacy -> Custom history -> Uncheck all
mate
- view -> show file browser -> project folder -> (dropdown) use * as project folder
- settings -> terminal -> shell support insatll
vscode
- settings gui -> "search: exclude" -> add "**/*lock.yaml"
- > Install 'code' command in PATH" command
zed
- /> cli: install cli binary
dbeaver
- window -> show view -> query manager
tailscale
https://login.tailscale.com/admin/machines -> Disable key expiry (trusted server)
install.sh
· 8.3 KiB · Bash
Raw
sudo echo
## reboot your mac and press ⌘+R
## csrutil disable
## reboot
## colors
red() { printf "\033[31m${1}\033[0m\n\n"; }
green() { printf "\033[32m${1}\033[0m\n\n"; }
blue() { printf "\033[38;5;27m${1}\033[0m\n" ; }
purple() { printf "\033[35m${1}\033[0m\n\n"; }
## show hidden files
defaults write com.apple.Finder AppleShowAllFiles true
# xcode
blue "Installing xcode"
xcode-select --install
# brew
blue "Installing brew"
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update --auto-update
brew analytics off
# git
blue "Installing git"
brew install gh
gh auth login
## zsh
bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
## brew
blue "Installing apps"
brew install git git-gui
brew install mos ffmpeg
brew install fastlane
brew install stats
brew install carthage
brew install lima
brew install swiftformat
brew install robotsandpencils/made/xcodes
brew install swiftlint
brew install mos asciinema
brew install imagemagick
brew install aria2
brew install mackup # backup
brew install jq
brew install swiftlint
brew install rsync
brew tap majd/repo
brew install ipatool
brew install jadx
brew install apktool
brew install grep ## ggrep (gnu-unix)
brew install ccat ## cat with format.
brew install duti ## set default app.
brew install ripgrep ## grep like, + recursive
brew install ngrok/ngrok/ngrok
brew install imagemagick
brew install rclone
brew install fd ## find alt
brew install bat
brew install tree
brew install gitui
brew install git-delta
brew install neofetch
brew install lolcat
brew install lesspipe ## advance less
brew install yt-dlp ## as youtube-dl weirdo
brew install imagemagick
brew install pngpaste
brew install micro ## editor
brew install vhs ## terminal recorder
brew install rustfmt
brew install jesseduffield/lazygit/lazygit
brew install glances ## htop
brew install mitmproxy
brew install php
brew install dua-cli
brew install gitleaks
brew install source-highlight
brew install rbenv
brew install jq
brew install yq
brew install scrcpy
brew install git-lfs
git lfs install
git lfs install --system
brew install --cask swiftformat-for-xcode
brew install --cask maccy
brew install --cask flameshot
brew install --cask vlc
brew install --cask localsend
brew install --cask lunar # brightness
brew install --cask ghostty
# brew install --cask jurplel/tap/instant-space-switcher # spaces
# brew install --cask xcodes
# brew install --cask devtoys
# brew install --cask hiddenbar
# brew install --cask swiftbar trex multi // create web application
# brew install --cask alt-tab
# brew install --cask pusher
# brew install --cask sequel-ace
# brew install --cask keycastr # keystroke visualizer
# brew install --cask linearmouse
# brew install --cask iconizer
# brew install --cask kap
# brew install --cask --no-quarantine middleclick
# brew install --cask amethyst rectangle // tiling window
# brew tap duongductrong/snapzy https://github.com/duongductrong/Snapzy && brew install --cask snapzy # screenshot
# https://caddy.community/t/caddy-on-mac-os-as-homebrew-service-autostart-on-system-startup/16940/2
brew install caddy
## vim
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim #plugin
# rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
## services
brew services start caddy
# /usr/local/etc/Caddyfile
curl -fsSL https://raw.githubusercontent.com/onmyway133/FinderGo/master/install.sh | sh
## font
blue "Installing fonts"
echo -e "\xee\x82\xa0"
brew tap homebrew/cask-fonts
brew install --cask font-fira-code
brew install font-hack-nerd-font
echo -e "\xee\x82\xa0"
# cli
curl -sL https://firebase.tools | bash
curl -fsSL https://d2lang.com/install.sh | sh -s -- # d2 for diagrams, arrows....
sh -c "$(curl -fsSL https://raw.githubusercontent.com/guarinogabriel/mac-cli/master/mac-cli/tools/install)"
curl https://raw.githubusercontent.com/ax/apk.sh/main/apk.sh -o /usr/local/bin/apk.sh
chmod +x /usr/local/bin/apk.sh
# node
brew install node
brew install watchman
brew install cocoapods
npm install --global web-ext
npm install --global git-format-staged
npm install -g react-native-cli
npm install -g yarn
npm install -g eslint
npm install -g terminalizer
# disk-space-analyzer
curl https://download.nektony.com/download/diskexpert/disk-space-analyzer.dmg -O
open disk-space-analyzer.dmg > /dev/null 2&>1 &
## sublime text
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
## fzf
brew install fzf
## dotfiles
blue "Config dotfiles https://www.atlassian.com/git/tutorials/dotfiles"
git init --bare $HOME/.cfg
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
config config --local status.showUntrackedFiles no
## vim
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim #plugin
# sudo part
## Enable install from anywhere
# https://www.reddit.com/r/MacOS/comments/pquuc4/comment/hdds9g0/
# https://maclife.io/huong-dan-tat-gatekeeper-bat-tuy-chon-anywhere-tren-macos-sierra-10-12-de-cai-ung-dung-ben-ngoai-app-store.html
sudo spctl --master-disable
sudo gem install cocoapods
sudo gem install screengrab
# exit
green "Install successfully, enjoy this awsome machine ❤️"
exit
## addition
[vscode xcode] https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line
[storage] https://nektony.com/disk-expert
[cliboard] flycut/cutbox
[editor] textmate coteditor
[vpn] warp 1.1.1.1
[player] https://github.com/iina/iina/releases/tag/v1.3.0
[extension] https://github.com/quoid/userscripts
[wiget] https://github.com/leits/MeetingBar
[ci] https://github.com/cirruslabs/tart
[vm] https://github.com/utmapp/UTM
[ipa] https://github.com/majd/ipatool
[xcode] https://github.com/RobotsAndPencils/XcodesApp
[emulator] https://github.com/PlayCover/PlayCover
[annotate, cite, and share research] https://www.zotero.org/
[terminal] https://iterm2.com/downloads.html
[keyboard] https://github.com/pqrs-org/Karabiner-Elements
[realm] https://studio-releases.realm.io/latest/download/mac-dmg https://github.com/dsmelov/simsim
[sketch] https://github.com/duraki/SketchCrapp
[record] https://github.com/onmyway133/GifCapture/releases/tag/1.1.0
[note] https://github.com/glushchenko/fsnotes
[convert video2gif] https://github.com/sindresorhus/Gifski
[download manager] https://github.com/agalwood/Motrix/releases
[wallpaper] https://github.com/rlxone/Equinox
[php] https://github.com/nicoverbruggen/phpmon
[firmware] https://github.com/ninxsoft/mist-cli
[xcodeproject] https://github.com/yonaskolb/XcodeGen
[calender] https://github.com/pakerwreah/Calendr
[java] https://www.oracle.com/java/technologies/downloads/#jdk19-mac
[automation] https://www.hammerspoon.org/go/
[video] https://github.com/mltframework/shotcut/releases
[xcode] https://github.com/Serchinastico/Kin
[database] https://github.com/dbeaver/dbeaver/releases
[default app] https://www.rubicode.com/Downloads/RCDefaultApp-2.1.X.dmg
[wasm] https://github.com/WebAssembly/wabt/releases/w
[launchctl] launchcontrol
[file-explorer] https://github.com/sayanarijit/xplr/releases | https://github.com/ranger/ranger | https://github.com/kamiyaa/joshuto | nnn | https://github.com/sxyazi/yazi
[file server] https://github.com/sigoden/dufs # webdav
[localsend] https://localsend.org/#/download # file sharing, airdrop
[teamview] https://github.com/rustdesk/rustdesk/releases # teamviewer alternative
[sql] drawsql.app
[disk] https://github.com/Byron/dua-cli?tab=readme-ov-file
[monitor brightness] https://github.com/alin23/Lunar
[export photo library ios] https://github.com/RhetTbull/osxphotos
[music lyric] buzz
[image compressor, blog] caesium image compressor
[vpn] tunelblick
[bloatware] uad-ng-macos
[window manager] https://github.com/MrKai77/Loop/releases/
[editor] https://zed.dev/download
[software] https://github.com/objective-see/KnockKnock
[server] https://github.com/lollipopkit/flutter_server_box
[network monitor] https://github.com/GyulyVGC/sniffnet
[slideshow] https://github.com/gobbledegook/creevey
[editor]https://github.com/sinelaw/fresh
[window managers] https://www.raycast.com/ | https://github.com/nikitabobko/AeroSpace
[video] https://github.com/HandBrake/HandBrake
[stats, monitor] https://github.com/exelban/stats
| 1 | sudo echo |
| 2 | |
| 3 | ## reboot your mac and press ⌘+R |
| 4 | ## csrutil disable |
| 5 | ## reboot |
| 6 | |
| 7 | |
| 8 | ## colors |
| 9 | red() { printf "\033[31m${1}\033[0m\n\n"; } |
| 10 | green() { printf "\033[32m${1}\033[0m\n\n"; } |
| 11 | blue() { printf "\033[38;5;27m${1}\033[0m\n" ; } |
| 12 | purple() { printf "\033[35m${1}\033[0m\n\n"; } |
| 13 | |
| 14 | |
| 15 | ## show hidden files |
| 16 | defaults write com.apple.Finder AppleShowAllFiles true |
| 17 | |
| 18 | # xcode |
| 19 | blue "Installing xcode" |
| 20 | xcode-select --install |
| 21 | |
| 22 | # brew |
| 23 | blue "Installing brew" |
| 24 | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 25 | brew update --auto-update |
| 26 | brew analytics off |
| 27 | |
| 28 | # git |
| 29 | blue "Installing git" |
| 30 | brew install gh |
| 31 | gh auth login |
| 32 | |
| 33 | ## zsh |
| 34 | bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)" |
| 35 | |
| 36 | ## brew |
| 37 | blue "Installing apps" |
| 38 | |
| 39 | brew install git git-gui |
| 40 | brew install mos ffmpeg |
| 41 | brew install fastlane |
| 42 | brew install stats |
| 43 | brew install carthage |
| 44 | brew install lima |
| 45 | brew install swiftformat |
| 46 | brew install robotsandpencils/made/xcodes |
| 47 | brew install swiftlint |
| 48 | brew install mos asciinema |
| 49 | brew install imagemagick |
| 50 | brew install aria2 |
| 51 | brew install mackup # backup |
| 52 | brew install jq |
| 53 | brew install swiftlint |
| 54 | brew install rsync |
| 55 | brew tap majd/repo |
| 56 | brew install ipatool |
| 57 | brew install jadx |
| 58 | brew install apktool |
| 59 | brew install grep ## ggrep (gnu-unix) |
| 60 | brew install ccat ## cat with format. |
| 61 | brew install duti ## set default app. |
| 62 | brew install ripgrep ## grep like, + recursive |
| 63 | brew install ngrok/ngrok/ngrok |
| 64 | brew install imagemagick |
| 65 | brew install rclone |
| 66 | brew install fd ## find alt |
| 67 | brew install bat |
| 68 | brew install tree |
| 69 | brew install gitui |
| 70 | brew install git-delta |
| 71 | brew install neofetch |
| 72 | brew install lolcat |
| 73 | brew install lesspipe ## advance less |
| 74 | brew install yt-dlp ## as youtube-dl weirdo |
| 75 | brew install imagemagick |
| 76 | brew install pngpaste |
| 77 | brew install micro ## editor |
| 78 | brew install vhs ## terminal recorder |
| 79 | brew install rustfmt |
| 80 | brew install jesseduffield/lazygit/lazygit |
| 81 | brew install glances ## htop |
| 82 | brew install mitmproxy |
| 83 | brew install php |
| 84 | brew install dua-cli |
| 85 | brew install gitleaks |
| 86 | brew install source-highlight |
| 87 | brew install rbenv |
| 88 | brew install jq |
| 89 | brew install yq |
| 90 | brew install scrcpy |
| 91 | |
| 92 | brew install git-lfs |
| 93 | git lfs install |
| 94 | git lfs install --system |
| 95 | |
| 96 | brew install --cask swiftformat-for-xcode |
| 97 | brew install --cask maccy |
| 98 | brew install --cask flameshot |
| 99 | brew install --cask vlc |
| 100 | brew install --cask localsend |
| 101 | brew install --cask lunar # brightness |
| 102 | brew install --cask ghostty |
| 103 | |
| 104 | # brew install --cask jurplel/tap/instant-space-switcher # spaces |
| 105 | # brew install --cask xcodes |
| 106 | # brew install --cask devtoys |
| 107 | # brew install --cask hiddenbar |
| 108 | # brew install --cask swiftbar trex multi // create web application |
| 109 | # brew install --cask alt-tab |
| 110 | # brew install --cask pusher |
| 111 | # brew install --cask sequel-ace |
| 112 | # brew install --cask keycastr # keystroke visualizer |
| 113 | # brew install --cask linearmouse |
| 114 | # brew install --cask iconizer |
| 115 | # brew install --cask kap |
| 116 | # brew install --cask --no-quarantine middleclick |
| 117 | # brew install --cask amethyst rectangle // tiling window |
| 118 | # brew tap duongductrong/snapzy https://github.com/duongductrong/Snapzy && brew install --cask snapzy # screenshot |
| 119 | |
| 120 | # https://caddy.community/t/caddy-on-mac-os-as-homebrew-service-autostart-on-system-startup/16940/2 |
| 121 | brew install caddy |
| 122 | |
| 123 | ## vim |
| 124 | curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ |
| 125 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim #plugin |
| 126 | |
| 127 | # rust |
| 128 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh |
| 129 | |
| 130 | ## services |
| 131 | brew services start caddy |
| 132 | # /usr/local/etc/Caddyfile |
| 133 | |
| 134 | curl -fsSL https://raw.githubusercontent.com/onmyway133/FinderGo/master/install.sh | sh |
| 135 | |
| 136 | ## font |
| 137 | blue "Installing fonts" |
| 138 | echo -e "\xee\x82\xa0" |
| 139 | brew tap homebrew/cask-fonts |
| 140 | brew install --cask font-fira-code |
| 141 | brew install font-hack-nerd-font |
| 142 | echo -e "\xee\x82\xa0" |
| 143 | |
| 144 | # cli |
| 145 | curl -sL https://firebase.tools | bash |
| 146 | curl -fsSL https://d2lang.com/install.sh | sh -s -- # d2 for diagrams, arrows.... |
| 147 | sh -c "$(curl -fsSL https://raw.githubusercontent.com/guarinogabriel/mac-cli/master/mac-cli/tools/install)" |
| 148 | |
| 149 | curl https://raw.githubusercontent.com/ax/apk.sh/main/apk.sh -o /usr/local/bin/apk.sh |
| 150 | chmod +x /usr/local/bin/apk.sh |
| 151 | |
| 152 | # node |
| 153 | brew install node |
| 154 | brew install watchman |
| 155 | brew install cocoapods |
| 156 | |
| 157 | npm install --global web-ext |
| 158 | npm install --global git-format-staged |
| 159 | npm install -g react-native-cli |
| 160 | npm install -g yarn |
| 161 | npm install -g eslint |
| 162 | npm install -g terminalizer |
| 163 | |
| 164 | |
| 165 | # disk-space-analyzer |
| 166 | curl https://download.nektony.com/download/diskexpert/disk-space-analyzer.dmg -O |
| 167 | open disk-space-analyzer.dmg > /dev/null 2&>1 & |
| 168 | |
| 169 | ## sublime text |
| 170 | |
| 171 | ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl |
| 172 | |
| 173 | ## fzf |
| 174 | brew install fzf |
| 175 | |
| 176 | ## dotfiles |
| 177 | blue "Config dotfiles https://www.atlassian.com/git/tutorials/dotfiles" |
| 178 | git init --bare $HOME/.cfg |
| 179 | alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' |
| 180 | config config --local status.showUntrackedFiles no |
| 181 | |
| 182 | ## vim |
| 183 | curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ |
| 184 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim #plugin |
| 185 | |
| 186 | |
| 187 | # sudo part |
| 188 | ## Enable install from anywhere |
| 189 | # https://www.reddit.com/r/MacOS/comments/pquuc4/comment/hdds9g0/ |
| 190 | # https://maclife.io/huong-dan-tat-gatekeeper-bat-tuy-chon-anywhere-tren-macos-sierra-10-12-de-cai-ung-dung-ben-ngoai-app-store.html |
| 191 | sudo spctl --master-disable |
| 192 | |
| 193 | sudo gem install cocoapods |
| 194 | sudo gem install screengrab |
| 195 | |
| 196 | # exit |
| 197 | green "Install successfully, enjoy this awsome machine ❤️" |
| 198 | exit |
| 199 | |
| 200 | ## addition |
| 201 | [vscode xcode] https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line |
| 202 | [storage] https://nektony.com/disk-expert |
| 203 | [cliboard] flycut/cutbox |
| 204 | [editor] textmate coteditor |
| 205 | [vpn] warp 1.1.1.1 |
| 206 | [player] https://github.com/iina/iina/releases/tag/v1.3.0 |
| 207 | [extension] https://github.com/quoid/userscripts |
| 208 | [wiget] https://github.com/leits/MeetingBar |
| 209 | [ci] https://github.com/cirruslabs/tart |
| 210 | [vm] https://github.com/utmapp/UTM |
| 211 | [ipa] https://github.com/majd/ipatool |
| 212 | [xcode] https://github.com/RobotsAndPencils/XcodesApp |
| 213 | [emulator] https://github.com/PlayCover/PlayCover |
| 214 | [annotate, cite, and share research] https://www.zotero.org/ |
| 215 | [terminal] https://iterm2.com/downloads.html |
| 216 | [keyboard] https://github.com/pqrs-org/Karabiner-Elements |
| 217 | [realm] https://studio-releases.realm.io/latest/download/mac-dmg https://github.com/dsmelov/simsim |
| 218 | [sketch] https://github.com/duraki/SketchCrapp |
| 219 | [record] https://github.com/onmyway133/GifCapture/releases/tag/1.1.0 |
| 220 | [note] https://github.com/glushchenko/fsnotes |
| 221 | [convert video2gif] https://github.com/sindresorhus/Gifski |
| 222 | [download manager] https://github.com/agalwood/Motrix/releases |
| 223 | [wallpaper] https://github.com/rlxone/Equinox |
| 224 | [php] https://github.com/nicoverbruggen/phpmon |
| 225 | [firmware] https://github.com/ninxsoft/mist-cli |
| 226 | [xcodeproject] https://github.com/yonaskolb/XcodeGen |
| 227 | [calender] https://github.com/pakerwreah/Calendr |
| 228 | [java] https://www.oracle.com/java/technologies/downloads/#jdk19-mac |
| 229 | [automation] https://www.hammerspoon.org/go/ |
| 230 | [video] https://github.com/mltframework/shotcut/releases |
| 231 | [xcode] https://github.com/Serchinastico/Kin |
| 232 | [database] https://github.com/dbeaver/dbeaver/releases |
| 233 | [default app] https://www.rubicode.com/Downloads/RCDefaultApp-2.1.X.dmg |
| 234 | [wasm] https://github.com/WebAssembly/wabt/releases/w |
| 235 | [launchctl] launchcontrol |
| 236 | [file-explorer] https://github.com/sayanarijit/xplr/releases | https://github.com/ranger/ranger | https://github.com/kamiyaa/joshuto | nnn | https://github.com/sxyazi/yazi |
| 237 | [file server] https://github.com/sigoden/dufs # webdav |
| 238 | [localsend] https://localsend.org/#/download # file sharing, airdrop |
| 239 | [teamview] https://github.com/rustdesk/rustdesk/releases # teamviewer alternative |
| 240 | [sql] drawsql.app |
| 241 | [disk] https://github.com/Byron/dua-cli?tab=readme-ov-file |
| 242 | [monitor brightness] https://github.com/alin23/Lunar |
| 243 | [export photo library ios] https://github.com/RhetTbull/osxphotos |
| 244 | [music lyric] buzz |
| 245 | [image compressor, blog] caesium image compressor |
| 246 | [vpn] tunelblick |
| 247 | [bloatware] uad-ng-macos |
| 248 | [window manager] https://github.com/MrKai77/Loop/releases/ |
| 249 | [editor] https://zed.dev/download |
| 250 | [software] https://github.com/objective-see/KnockKnock |
| 251 | [server] https://github.com/lollipopkit/flutter_server_box |
| 252 | [network monitor] https://github.com/GyulyVGC/sniffnet |
| 253 | [slideshow] https://github.com/gobbledegook/creevey |
| 254 | [editor]https://github.com/sinelaw/fresh |
| 255 | [window managers] https://www.raycast.com/ | https://github.com/nikitabobko/AeroSpace |
| 256 | [video] https://github.com/HandBrake/HandBrake |
| 257 | [stats, monitor] https://github.com/exelban/stats |
| 258 |