Користувальницькькі налаштування

Налаштування сайту


software:os:mac:install

Розбіжності

Тут показані розбіжності між вибраною ревізією та поточною версією сторінки.

Посилання на цей список змін

Порівняння попередніх версій Попередня ревізія
Наступна ревізія
Попередня ревізія
software:os:mac:install [2026/03/27 03:18]
charon [Improve .zshrc]
software:os:mac:install [2026/03/27 23:28] (поточний)
charon [Zsh config]
Рядок 61: Рядок 61:
 brew "telnet" brew "telnet"
 brew "wget" brew "wget"
 +brew "git"
 brew "ykman" brew "ykman"
 +brew "coreutils"
 brew "neofetch" brew "neofetch"
 +brew "eza"
 # Next GUI programs # Next GUI programs
 cask "iterm2" cask "iterm2"
Рядок 122: Рядок 125:
 Instant Prompt Mode: Verbose Instant Prompt Mode: Verbose
 Save: Yes Save: Yes
 +</code>
 +
 +===== Install useful ZSH plugins =====
 +Let's add plugins //zsh-autosuggestions, zsh-syntax-highlighting//:
 +<code>
 +brew install zsh-autosuggestions zsh-syntax-highlighting
 +mkdir -pv ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/{zsh-autosuggestions,zsh-syntax-highlighting}
 +ln -s $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
 +ln -s $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
 </code> </code>
  
Рядок 137: Рядок 149:
 fi fi
 </code> </code>
-After "#export PATH" add next block:+After "#export PATH" line add next block:
 <code> <code>
 typeset -U path typeset -U path
Рядок 147: Рядок 159:
 ) )
 </code> </code>
 +Now scroll to "plugins=" and change to:
 +<code>
 +plugins=(
 +  git
 +  terraform
 +  direnv
 +  z
 +  zsh-autosuggestions
 +  zsh-syntax-highlighting
 +)
 +</code>
 +remove git and terraform for personal computer
 +
 +===== Configure iTerm2 =====
 +Create new profile by duplicating default one.
 +
 +In Text tab:
 +<code>
 +Font: JetBrainsMono Nerd Font Mono
 +Boldness: Medium (or play yourself)
 +Size: 15-16
 +</code>
 +Consider setting "Use ligatures"
 +
 +===== Zsh aliases =====
 +Add next files to //~/.oh-my-zsh/custom// directory:
 +<file text my-aliases-common.zsh>
 +### Common aliases
 +alias dir="ls -a"
 +alias l="ls -la"
 +if (( $+commands[eza] )); then
 +  alias ls2='eza --group-directories-first --icons'
 +  alias dir2='ls2 -a'
 +  alias la2='ls2 -a'
 +  alias ll2='ls2 -l --group'
 +  alias tree2='ls2 --tree'
 +fi
 +alias cls="clear"
 +alias cw="clear; w"
 +alias x="exit"
 +alias tree="\tree -C --dirsfirst"
 +alias bc="bc -ql"
 +alias tt=traceroute
 +alias ports="sudo netstat -luntp"
 +alias myip="curl -s icanhazip.com"
 +alias weather='curl wttr.in/kyiv'
 +alias batcat="bat"
 +alias h='fc -li'
 +alias hg='fc -li | grep'
 +alias va='source ./venv/bin/activate'
 +alias ve='python3 -m venv ./venv'
 +alias list_instances="aws ec2 describe-instances --no-cli-pager --color off --filters Name=tag-key,Values=Name Name=instance-state-name,Values=running --query 'Reservations[*].Instances[*].{Instance_Id:InstanceId,Type:InstanceType,Public_IP:PublicIpAddress,Private_IP:PrivateIpAddress,SSH_Key:KeyName,Name:Tags[?Key==\`Name\`]|[0].Value}' --output table"
 +
 +# Find top 5 big files
 +alias findbig="find . -type f -exec ls -s {} \; | sort -n -r | head -5"
 +
 +# To clear all the history and screen
 +alias hcl='history -c; clear'
 +
 +# Make basic commands verbose
 +alias cp="cp -v"
 +alias rm="rm -v"
 +alias mv="mv -v"
 +
 +# To navigate to the different directories
 +alias ..='cd ..'
 +alias ...='cd ../..'
 +
 +# Create and change to a new directory
 +mcd() {
 +    if [[ -z "$1" ]]; then
 +        echo "Usage: mcd <directory>"
 +        return 1
 +    fi
 +    mkdir -p "$1" && cd "$1"
 +}
 +
 +# display currently mounted file systems nicely
 +showmounted() { (echo "DEVICE PATH TYPE FLAGS" && mount | awk '$2=$4="";1') | column -t; }
 +
 +# Local aliases
 +alias gfo="git fetch origin && git status"
 +alias zimdate="LC_TIME=en_US.UTF-8 date '+Week %V%n%A, %d.%m.%Y'"
 +
 +if (( $+commands[apg] )); then
 +    alias apg1="apg -a 0 -n 1 -m 8 -x 10 -M NCL -E I1l0O"
 +    alias apg2="apg -a 0 -n 1 -m 14 -x 16 -M NCL -E I1l0O"
 +    alias apg3="apg -a 0 -n 1 -m 14 -x 16 -M NCLS -E I1l0O"
 +fi
 +
 +#########################################################################################
 +### OS-specific
 +case "$(uname)" in
 +  Darwin)
 +    # Configuration if Brew installed
 +    () {
 +        local bp=""
 +        [[ -x /opt/homebrew/bin/brew ]] && bp="/opt/homebrew"
 +        [[ -x /usr/local/bin/brew ]] && bp="/usr/local"
 +
 +        if [[ -n "$bp" ]]; then
 +            export HOMEBREW_AUTO_UPDATE_SECS=86400
 +            export HOMEBREW_NO_ANALYTICS=1
 +
 +            if (( $+commands[gls] )); then
 +                # Using local variable for aliases
 +                alias ls="$bp/bin/gls --color=never -F --group-directories-first"
 +                alias date="$bp/bin/gdate"
 +                alias findbig="gfind . -type f -printf '%s %p\n' | sort -rn | head -5"
 +            else
 +                [[ -t 1 ]] && echo "\e[33mNotice:\e[0m Coreutils not found. Run: brew install coreutils"
 +            fi
 +        fi
 +    }
 +
 +    alias openfinder='open -a Finder $1'
 +    alias flushdns='sudo dscacheutil -flushcache'
 +    alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" # This alias will find and delete all ".DS_Store" files in the current directory and all subdirectories.
 +    alias battery="pmset -g batt | grep -Eo '[0-9]+%' | sed 's/%//'"
 +    alias play_alert='afplay ~/Sync/music/effects/Train\ Fx\ 2.wav'
 +    alias update='~/scripts/update_macos.sh'
 +    alias showfiles='defaults write com.apple.finder AppleShowAllFiles YES && killall Finder'
 +    alias hidefiles='defaults write com.apple.finder AppleShowAllFiles NO && killall Finder'
 +    alias localip='ipconfig getifaddr en0'
 +    ;;
 +  Linux)
 +    alias ls='/bin/ls --color=never -F --group-directories-first'
 +    alias bat='/usr/bin/batcat'
 +    alias monitor_turn_off='xset dpms force off'
 +    alias play_alert='aplay ~/Sync/music/effects/Train\ Fx\ 2.wav'
 +    alias psc='ps xawf -eo pid,user,cgroup,args'
 +    alias pss='systemd-cgls'
 +    alias update='~/scripts/update.sh'
 +    alias update_download_only='sudo apt update && sudo apt upgrade --download-only --assume-yes'
 +    alias update_small='sudo apt upgrade --assume-yes'
 +    alias pbcopy="$HOME/scripts/stub_pbcopy.sh"
 +    alias findbig="find . -type f -exec ls -s {} \; | sort -n -r | head -5"
 +    ;;
 +esac
 +
 +# Pictures (ZSH suffixes)
 +if [[ "$TERM_PROGRAM" == "WezTerm" ]]; then
 +    alias icat="wezterm imgcat"
 +elif [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
 +    alias icat="imgcat"
 +elif [[ "$TERM" == *"konsole"* ]]; then
 +    alias icat="img2sixel"
 +else
 +    alias icat="open"
 +fi
 +
 +alias -s png="icat"
 +alias -s jpg="icat"
 +alias -s jpeg="icat"
 +alias -s gif="icat"
 +alias -s bmp="icat"
 +alias -s webp="icat"
 +alias -s ico="icat"
 +# preview all images in current directory
 +icatdir() {
 +  for img in *.{png,jpg,jpeg,gif,webp,bmp}(N); do
 +    echo "--- $img ---"
 +    icat "$img"
 +  done
 +}
 +</file>
 +alias nosleep='caffeinate -dims'
 +===== Zsh config =====
 +Add next files to //~/.oh-my-zsh/custom// directory:
 +<file text my-congif.zsh>
 +###########
 +# History #
 +###########
 +HISTFILE=$HOME/.zsh_history
 +HISTSIZE=10000
 +SAVEHIST=10000
 +setopt EXTENDED_HISTORY
 +setopt SHARE_HISTORY
 +setopt HIST_IGNORE_DUPS
 +setopt HIST_IGNORE_SPACE
 +setopt HIST_REDUCE_BLANKS
 +setopt HIST_VERIFY
 +# Next is Oh-my-zsh specific
 +HIST_STAMPS="yyyy-mm-dd HH:MM:SS"
 +
 +########
 +# MISC #
 +########
 +
 +export EDITOR=vim
 +export VISUAL=vim
 +export LESS="-e -X"
 +
 +case "$(uname)" in
 +  Darwin)
 +    export GPG_TTY=$(tty)
 +    path+=($HOME/scripts)
 +    ;;
 +  Linux)
 +    export SSH_ASKPASS=/usr/bin/ksshaskpass
 +    export XDG_CONFIG_HOME=$HOME/.config
 +    export XDG_CACHE_HOME=$HOME/.cache
 +    export XDG_DATA_HOME=$HOME/.local/share
 +    export XDG_STATE_HOME=$HOME/.local/state
 +    path+=(/usr/local/scripts $HOME/scripts)
 +    ;;
 +esac
 +</file>
 +
 +===== (Optional) Install NodeJS =====
 +Install NodeJS:
 +  brew install node@24
 +check version, choose latest LTS: https://endoflife.date/nodejs
 +
 +Configure directory for global packages:
 +  mkdir -p ~/.npm-global
 +  npm config set prefix ~/.npm-global
 +
 ===== Links ===== ===== Links =====
   * [[https://brew.sh/|Homebrew]]   * [[https://brew.sh/|Homebrew]]
software/os/mac/install.1774574310.txt.gz · Востаннє змінено: 2026/03/27 03:18 повз charon