MacOS Tips & Tricks
Tags: macos, tutorial
Published: 2022-11-13 15:14:04

## Table of Contents
1. [Charge Limiter](#charge-limiter)
1. [Microsoft AutoUpdate](#microsoft-autoupdate)
1. [Dock](#dock)
1. [Menu Bar](#menu-bar)
1. [Brew](#brew)
1. [Updating everything Automatically](#updating-everything-automatically)
1. [Useful Application](#useful-application)
1. [ZSH](#zsh)
1. [Shortcuts](#shortcuts)
1. [The Power of Option key](#the-power-of-option-key)
1. [Common errors](#common-errors)
1. [General Tips](#general-tips)
1. [Useful Sites](#useful-sites)
1. [Other Resources](#other-resources)


----

## Charge Limiter

You can use one of these to limit how much your MacBook charges:
- [AlDente](https://github.com/davidwernhart/AlDente-Charge-Limiter)
- [Battery (CLI)](https://github.com/actuallymentor/battery)

Make sure you read the readme file and know what you are doing. In most cases, you don't need this but if you are a pro user, you might like controlling it yourself.

----

## Microsoft AutoUpdate

Disable opening popup every day ([source](https://superuser.com/questions/1544338/turn-off-microsoft-apps-auto-update-on-a-mac))

```bash
sudo plutil -replace StartInterval -integer 864000 /Library/LaunchAgents/com.microsoft.update.agent.plist
sudo plutil -replace RunAtLoad -bool no /Library/LaunchAgents/com.microsoft.update.agent.plist
```

Check for update manually ([source](https://docs.microsoft.com/en-us/deployoffice/mac/update-office-for-mac-using-msupdate))

```bash
/Library/Application\ Support/Microsoft/MAU2.0/Microsoft\ AutoUpdate.app/Contents/MacOS/msupdate -l
```

Open GUI manually:

```bash
/Library/Application\ Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app
```

----

## Dock

Location of the setting file: `/Users/[user-name]/Library/Preference/com.apple.Dock`

Parameters description: [https://developer.apple.com/documentation/devicemanagement/dock](https://developer.apple.com/documentation/devicemanagement/dock)

Lock size of the dock

```bash
defaults write com.apple.dock size-immutable -bool true; killall Dock
```

Lock position of the dock

```bash
defaults write com.apple.dock position-immutable -bool true; killall Dock
```

Add empty item

```bash
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
```

Revert to default

```bash
defaults delete com.apple.dock; killall Dock
```

----

## Menu Bar

In order to make it visible even in the fullscreen mode, you can go to `System Preferences > Dock and Menu Bar` and uncheck `Automatically hide and show the menu bar in full screen`

You can also set it individually for each app: (true means it will show it all the time in the fullscreen mode)

```jsx
defaults write com.example.SomeApp AppleMenuBarVisibleInFullscreen -bool true
```

> 💡 If you don’t know the app bundle identifier name, [follow the first general tip](#general-tips).

----

## Brew

Get the list of installed packages:
``` bash
brew leaves
```

Packages that I like to install:
```
cocoapods
composer
ffmpeg
gh
jq
openjdk
php
```

----

## Updating everything Automatically

Brew

```bash
brew update && brew upgrade && brew upgrade --cask
```

Python packages (without package manager)

```bash
python3 -m pip install -U pip
pip3 list --outdated --format=json | jq -r '.[] | "\(.name)==\(.latest_version)"' | xargs -n1 pip3 install -U
```

Check system updates

```bash
softwareupdate -l
```

AppStore installed apps

```bash
brew install mas # install
mas outdated # show all the packages that need update
mas upgrade # update all of them
```

----

## Useful Application

**Free/OpenSource:**

- [Shottr](https://shottr.cc/) → Screenshot / OCR / Scrolling Screenshot
- [AltTab](https://alt-tab-macos.netlify.app/) → Window switcher with previews
- [Maccy](https://github.com/p0deje/Maccy) → Clipboard manager
- [iTerm2](https://iterm2.com/) → Terminal emulator
- [LyricsX](https://github.com/ddddxxx/LyricsX) → Lyrics overly
- [HandBrake](https://handbrake.fr/) → Compress and convert video
- [AppCleaner](https://freemacsoft.net/appcleaner/) → Uninstall apps
- [Amphetamine](https://apps.apple.com/us/app/amphetamine/id937984704) → Energy saver settings
- [Karabiner-Elements](https://karabiner-elements.pqrs.org/) -> A powerful keyboard customizer
- [Yabai](https://github.com/koekeishiya/yabai) -> Tiling window management
- [MonitorControl](https://github.com/MonitorControl/MonitorControl) -> Control external display's brightness & volume
- [MOS](https://mos.caldis.me/) -> Smooth scrolling and set scroll direction
- [Raycast](https://www.raycast.com/) -> Better Spotlight
- [ImageOptim](https://imageoptim.com/mac) -> Reduces image file sizes
- [DBngin](https://dbngin.com/) -> Database Version Management Tool
- [TablePlus](https://tableplus.com/) -> Database management

**CLI:**

- [mas](https://github.com/mas-cli/mas) -> Mac App Store command line interface
- [YT-DLP](https://github.com/yt-dlp/yt-dlp) -> Download video/audio from youtube

**Paid:**

- [BetterTouchTool](https://folivora.ai/) -> Customize various input devices
- [Bartender](https://www.macbartender.com/) -> Control and customize menu bar
- [Sound Source](https://rogueamoeba.com/soundsource/) -> Sound control for apps and 3rd party monitors
- [MacUpdater](https://www.corecode.io/macupdater/) -> Automatically track the latest updates of all applications installed
- [Movist](https://movistprime.com/) -> Better video player

----

## ZSH

Oh My ZSH install

```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
```

Configuration

```bash
ZSH_THEME="robbyrussell"
DISABLE_UPDATE_PROMPT="true"
HIST_STAMPS="yyyy/mm/dd"

plugins=(git extract zsh-autosuggestions)
```

Useful Plugins ([all](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins))

```bash
# zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
```

----

## Shortcuts

- Change volume in small increments: `Shift ⇧ + Option ⌥ (alt) + Volume Up/Down`
- Change brightness in small increments: `Shift ⇧ + Option ⌥ (alt) + Brightness Up/Down`
- Entering/Exiting fullscreen mode: `fn + F`
- Paste without formatting: `Command ⌘ + Option ⌥ (alt) + Shift ⇧ + V`
- Permanent deleting a file: `Command ⌘ + Option ⌥ (alt) + Backspace`
- Show hidden files in Finder: `Command ⌘ + Shift ⇧ + .`

----

## The Power of Option key

Do all of these when holding the `Option` key!

- Hit the volume icon to see both input and output
- Hit wifi icon to see every little detail
- Hit menu bar items to see other options
- Hit close window to close all instances of that application
- Right click after you copied something to show `Move item here` instead of paste.
- When seeing an image, Click on `File > Save As` while holding the option to convert your image to other formats. When selecting a format, hold the option to see more formats!

----

## Common errors

- App is damaged and can’t be opened. You should move it to the Trash.

```bash
sudo xattr -rd /Applications/[name].app
```

----

## General Tips

1- **Finding app bundle identifier:**

```jsx
osascript -e 'id of app "TextEdit"'
```

2- **Three-finger drag:**

Go to `System Preferences > Accessibility > Pointer Control > Trackpad options` and then enable dragging with  `three finger drag`. Now you can drag any window with three fingers.

3- **Change drag & drop speed:**

Go to `System Preference > Accessibility > Pointer Control` and change `Spring-loading delay`.


----

## Useful Sites

- [App Icons](https://macosicons.com/#/)
- [Compatibility of every game on M1](https://www.applegamingwiki.com/wiki/Home)
- [Sideload iOS apps on macOS](https://github.com/PlayCover/PlayCover)
- [M1 supported application list](https://doesitarm.com/)


----

## Other Resources

- [Defaults Commands](https://macos-defaults.com/)
- [MacOS Awesome](https://github.com/jaywcjlove/awesome-mac)
- [Finder Tips](https://www.fourth-wall.co.uk/post/my-16-favourite-finder-tips-for-mac)
- Jesse Skelto's Karabiner and Yabai tutorials
  - [Karabiner| Part 1](https://www.youtube.com/watch?v=uaJSjgVEhMQ)
  - [Karabiner| Part 2](https://www.youtube.com/watch?v=PBPS2D9AKtI)
  - [Yabai](https://www.youtube.com/watch?v=JL1lz77YbUE)
- [devnoname120's macOS setup](https://gist.github.com/devnoname120/4767a0aa18879217170fd0c68809fc24)
- [nnja's new computer](https://github.com/nnja/new-computer)