macOS tips and tricks

This page contains my personal tips and tricks for macOS.

Useful apps

Bash

  • Upgrade bash: https://stackoverflow.com/a/77052639/15647
  • Install bash-completion compatible with the new version. For Homebrew the name of the formula is bash-completion@2. Pay attention to Homebrew’s output to properly update .bash_profile
  • Add the following lines to .bash_profile to have nice colors and prompt:
    export LANG=en_US.UTF-8
    
    # Enable colored output for ls command
    export CLICOLOR=1
    export LSCOLORS="ExFxCxDxBxegedabagaced"
    
    #
    # Git prompt
    #
    GIT_PS1_SHOWSTASHSTATE=1
    GIT_PS1_SHOWUNTRACKEDFILES=1
    GIT_PS1_SHOWDIRTYSTATE=1
    GIT_PS1_SHOWCOLORHINTS=1
    GIT_PS1_SHOWUPSTREAM=auto
    PROMPT_COMMAND='__git_ps1 "\[\e[34m\]\w\[\e[m\]" "\\\$ "'
    

Misc

  • Make ssh-agent to store keys in memory so that you don’t have to type passphrases all the time (more details https://developer.apple.com/library/archive/technotes/tn2449/_index.html):

    ~/Desktop$ cat ~/.ssh/config
    AddKeysToAgent yes
    
  • Spell checking in Ukrainian (although it doesn’t work with “Automatic by Language”): https://apple.stackexchange.com/a/262448/241119

  • Move focus between controls using the Tab key: System Settings -> Keyboard -> Keyboard navigation

  • TextEdit:

    • Settings -> New Document -> Format -> Plain text
  • To change OS requirements for a .pkg file do the following:

    # Expand the distribution package
    pkgutil --expand VendorPackageWithLimitations.pkg /tmp/VendorPackageWithLimitations
    # Edit file 'Distribution'
    # Flatten the package again
    pkgutil --flatten /tmp/VendorPackageWithLimitations/ VendorPackageWithoutLimitations.pkg