Skip to main content


NameCharacterkbdPhysical key
Command⊞ Windows
Option / AltAlt


Advanced macOS Command-Line Tools -

What prevents Mac to sleep: pmset -g assertions. See

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 - -

Add sleep shortcut

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.

Prevent ⌘+i to open the Mail app on Chrome

Ventura: Configuració → Teclat → Dreceres de teclat... → Dreceres de l'app. Clicar '+'. Al menú que s'obre seleccionar:

  • App: Google Chrome.
  • Títol de menú: ha de ser exactament "Envia l'enllaç per correu electrònic". És el que diu a Chrome → Fitxer → Comparteix.
  • Drecera de teclat: qualsevol cosa, per exemple ⌃⌥⇧⌘E.


"^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.).



Color schemes -

Changed in Settings → Profiles → Colors, at the dropdown 'Color presets...'. Tip: duplicate the current profile to make tests.

Finder integration (New iTerm Window here)

Click the 'iTerm2' menu bar item (at the top left) and then do Services → Services Settings... This opens the 'Configuració del Sistema' → Teclat → Dreceres de teclat... Once there, on 'Arxius i carpetes' check 'New iTerm Window here'.



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.

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

"send hex code" vs "send escape sequence"


  • “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

Shortcuts and tricks

  • Undo close: when you close a session tab by accident, you can restore it with Edit → Undo or Cmd+Z.
    • Important: adjust the timeout in Settings → Profiles → Session, at "Undo can revive a session that has been closed for up to X seconds". Default value is 5 seconds. Should be changed to about 25 seconds.
  • Hold Cmd+Option to select text with the mouse doing a rectangle


Used by Little Snitch and Razer Synapse.

Are located in /Library/Extensions/.

Free up disk space

  • This frees plenty GBs Android emulators, system images, SDKs, build tools, NDK etcetera:
    • To get rid of Android emulators, open Android Studio → Device Manager and delete them.
    • To get rid of Android system images, SDKs and other stuff, open Android Studio → SDK Manager. (There are various ways to open it, eg Settings → Languages & Frameworks → Android SDK). Once thee, check the checkbox 'Show package details'. Then uninstall everything possible like the NDK, emulator System Images, SDKs etcetera.
  • 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:
    • 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 Configuració → Dades i emmagatzematge → Ú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').