Skip to main content

macOS

NameCharacterkbdPhysical key
Command⊞ Windows
ControlCtrl
ShiftMayús
Option / AltAlt
EscapeEsc

Glyps

What prevents Mac to sleep: pmset -g assertions. See https://osxdaily.com/2012/07/11/mac-wont-sleep-heres-how-to-find-out-why-and-fix-it

Keyboard Shortcuts

Mac keyboard shortcuts

Cycle current application’s windows: + `

Character Viewer (emoji picker): + Ctrl + Space

Show/hide hidden files: + Shift + .

All my macOS keyboard shortcuts - https://www.jamieonkeys.dev/posts/keyboard-shortcuts - https://news.ycombinator.com/item?id=30876934

Add sleep shortcut

https://apple.stackexchange.com/a/431149/241238

Monterey: Preferències -> Teclat -> pestanya Dreceres -> Dreceres de l'app. Ventura: Configuració -> Teclat -> Dreceres de teclat... -> Dreceres de l'app. Afegir 2 dreceres noves amb nom 'Sleep' i 'Repòs' a ShiftAltQ. Haig de veure el shortcut ⌥⇧Q al menu del sistema.

DefaultKeyBinding.dict

{
"^u" = "deleteWordBackward:";
"^o" = "deleteWordForward:";
"^j" = "moveWordBackward:";
"^l" = "moveWordForward:";
}

Place this file in ~/Library/KeyBindings/ (create the folder if it doesn't exist yet).

Note that you need to restart the apps to take effect (eg run killall Finder to restart Finder, close and open Firefox etc.).

Examples:

iTerm2

note

I've already added these shortcuts in the past. Thus, to have them in a new iTerm2 installation, I don't have to add them manually again, I can simply import either the profile .json file or the .itermkeymap file.

Note that the .json profile contains all the shortcuts of the .itermkeymap file, so if we import the profile we don't have to import the .itermkeymap afterwards.

Go to Preferences -> Profiles tab -> Keys tab -> Key Mappings tab. Click the + button.

ShortcutsDescriptionActionSend
Alt+← Ctrl+jMove word leftSend Escape Sequenceb
Alt+→ Ctrl+lMove word rightSend Escape Sequencef
Ctrl+uDelete word leftSend Hex Codes0x1b 0x08 (could instead be 0x17, see StackOverflow below)
Ctrl+oDelete word rightSend Hex Codes0x1b 0x64

https://stackoverflow.com/questions/6205157/how-to-set-keyboard-shortcuts-to-jump-to-beginning-end-of-line/29403520#29403520

"send hex code" vs "send escape sequence"

From https://sergeemond.ca/en/articles/iterm-extend-send-text-action

  • “send escape sequence” simply sends a “\e” followed by the text as-is
  • “send hex code” scans for one 8-bit code, and sends that
  • “send text” allows for “\e” (escape), “\n” (newline), “\a” (bell), and “\t” (tab), and normal text

kexts

Used by Little Snitch and Razer Synapse.

Are located in /Library/Extensions/.

Free up disk space

  • Delete node_modules folders with npkill. Usage: npx npkill --directory ~/Programming.
  • Delete build folders: find . -type d -name "build" -exec rm -rf {} +.
  • Delete Python venv folders: find . -type d -name "venv" -exec rm -rf {} +.
  • Xcode
  • JetBrains IDEs, delete old versions: Help -> Delete Leftover IDE Directories…
    • JetBrains IDEs are located at ~/Library/Application Support/JetBrains (cd ~/Library/Application\ Support/JetBrains).
    • Android Studio is located at ~/Library/Application Support/Google (cd ~/Library/Application\ Support/Google).
  • Docker:
    • Docs: Prune unused Docker objects: https://docs.docker.com/config/pruning.
    • Remove dangling images (images with <none> in docker image ls): docker image prune (docs)
      • IMPORTANT: be careful with docker image prune -a because it deletes plenty of stuff, eg it has deleted all images shown by docker image ls, not only the ones with <none>! It says WARNING! This will remove all images without at least one container associated to them..
    • Pune everything: docker system prune. This removes all stopped containers, all networks not used by at least one container, all dangling images and all build cache.
  • Anar a ~/Library/Application Support i esborrar programes antics.
  • Esborrar fitxers grans: Sobre aquest Mac -> Emmagatzematge -> Gestionar...
  • Telegram: esborrar la memòria cau (pot tenir 1 GB). Es fa a "Ús de l'emmagatzematge"
  • Firefox: esborrar dades del lloc (pot ser 3 GB). Anar a Preferències -> Privadesa i seguretat -> Gestiona les dades... S'ordenen per mida. Cal apretar Delete a cada Lloc i després 'Desa els canvis' (sinó no esborra). Esborrar les que fa més d'un any que es van fer servir ('Darrer ús').