MacOS
Table of Contents
MacOS
Flatten PDF file
brew install imagemagickconvert -density 150 document_original.pdf document_flat.pdfDisable closing apps automatically
defaults write -g NSDisableAutomaticTermination -bool yesRemove exif info from photo or video
brew install exiftoolexiftool -overwrite_original -All= FILENAMEiCloud sync
fileproviderctl domain listfileproviderctl check -ffileproviderctl check -v # show detailsfileproviderctl repair -v # riskyThe following command could be used to remove empty files - with confirmation:
find ./ -type f -size 0 -exec rm -i {} \;Screen resolution
https://www.walvisions.com/PattPages/1-complex_test.html
High Quality Bluetooth Settings
To enable high quality Bluetooth settings for the headset as per https://www.macrumors.com/how-to/enable-aptx-aac-bluetooth-audio-codecs-macos/:
sudo defaults write bluetoothaudiod "Enable AptX codec" -bool truesudo defaults write bluetoothaudiod "Enable AAC codec" -bool trueHibernate
https://www.jinx.de/SmartSleep.html
as per this wonderful article.
sudo pmset -a acwake 0sudo pmset -a lidwake 0sudo pmset -a ttyskeepawake 0sudo pmset -a darkwakes 0sudo pmset -a sleep 0sudo pmset -a standby 0sudo pmset -a standbydelay 5sudo pmset -a hibernatemode 25sudo pmset -a proximitywake 0Checks, as per that page
pmset -g | grep hibernatemode #check current modepmset -g | grep sleep #shows services, that prevents hibernationpmset -g assertions #shows triggers to wake uppmset -g log
- hibernatemode 0 (standard sleep)
- hibernatemode 1 (hibernate mode, for pre-2005 portable MacBooks)
- hibernatemode 3 (safe sleep)
- hibernatemode 25 (hibernate mode for post-2005 MacBooks)
3 - sleep by default 25 - hibernate on my macbook
As per that page:
# Always use the integrated graphics card while running on battery powersudo pmset -b gpuswitch 0
# Always use the discrete graphics card while running on battery powersudo pmset -b gpuswitch 1
# Switch between discrete and integrated graphics cards automatically while running on battery powersudo pmset -b gpuswitch 2And if you want to control this setting globally, whether your laptop is plugged in or not, you just need to change pmset -b to pmset -c.
# Always use the integrated graphics cardsudo pmset -a gpuswitch 0
# Always use the discrete graphics cardsudo pmset -a gpuswitch 1
# Automatically switch between discrete and integrated graphics card (this is your laptop's default setting)sudo pmset -a gpuswitch 2Reset SMC & NVRAM
SMC
- Shut down your Mac.
- Press and hold Shift, Control, and Option on the left side of the keyboard. Now press and hold the Power button (or Touch ID button) as well.
- Hold all the keys down for 10 seconds.
- Release all the keys and turn on your MacBook.
NVRAM
- Shut down your Mac.
- Press the power button.
- Before the grey screen appears, press the Command, Option, P, and R keys at the same time.
- Hold the keys until your computer restarts and you hear the startup sound a second time.
- On Macs with the T2 Security Chip, hold the keys until the Apple logo appears and disappears for the second time.
- Release the keys
zshrc
.zshrc for ssh autocompletion (on MacOS)
# quickly check latest commandsalias h="history -10"
# ~/.ssh/config based ssh autocomplete# Highlight the current autocomplete optionzstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# Better SSH/Rsync/SCP Autocompletezstyle ':completion:*:(scp|rsync):*' tag-order ' hosts:-ipaddr:ip\ address hosts:-host:host files'zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost ip6-localhost broadcasthostzstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*'
# Allow for autocomplete to be case insensitivezstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' \ '+l:|?=** r:|?=**'
# Initialize the autocompletionautoload -Uz compinit && compinit -i
# iTerm2 integrationtest -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"precmd() { print "" }zsh ssh autocomplete integration is a courtesy of Cody Hiar.
Other
- install zsh autocomplete:
brew install zsh-autocomplete