Mac

Specific Tips for ARM Mac.

See also: How many multiple display can you connect?

Mostly for myself when setting up macOS. Make daily programming activity more productive. Security: Read Safely open apps on your Mac.

Allow me to introduce a site before The main dish:

The Original Macintosh - Anecdotes about the development of Apple’s original Macintosh, and the people behind it.

Symbol for keys:

Command (or Cmd) ⌘
Shift ⇧
Option (or Alt) ⌥
Control (or Ctrl) ⌃
Caps Lock ⇪
Fn

⌥+⇧+] for typing (instead of normal ').

https://github.com/ohmyzsh/ohmyzsh with zsh-autosuggestions and fzf

THIS WILL FORCE RESTART YOUR COMPUTER

$ softwareupdate --all --install --force

THIS WILL FORCE RESTART YOUR COMPUTER

Hold down a key and enter them fastly.

defaults write -g KeyRepeat -int 2
defaults write -g InitialKeyRepeat -int 12

The lower the number, the faster it is.

KeyRepeat: 120, 90, 60, 30, 12, 6, 2
InitialKeyRepeat: 120, 94, 68, 35, 25, 15

When you scroll, hold Shift ⇧ it will become horizontal scroll.

Add this line to /etc/pam.d/sudo:

auth       sufficient     pam_tid.so

HOWTO use it (Noise cancelling, mode switching, etc).

This may help

killall coreaudio

Restart your computer or repair (Bluetooth).

Only works for intel Mac.

For better headlphone performance.

sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true
sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true

System Preferences > Keyboard > App Shortcuts > All Applications

add "Paste and Match Style" ⌘V
add "Paste" ⌘V

Context

Use Preview, File > Screenshot > Full Screen and it will take a sreenshot of whole screen after few seconds. Then edit the full-screen screenshot to what you want.

I now uses CleanShot X.

⌘+⇧+5, options, turn off thumbnail.

Only check AirDrop, Applications, Desktop, Downloads, home folder, External disks

defaults write com.apple.finder AppleShowAllFiles YES

defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool NO

xattr -rd com.apple.quarantine /path/to/your/thing

Turned on Expanded Control Strip & Remove Siri.

See this post.

pkill "Touch Bar agent";
killall "ControlStrip";

Fill out and sign PDF forms in Preview on Mac.

⌃ + ⌘ + space to pull up emoji selection menu.

Orta’s Keyboard Shortcuts and Apple’s official guide.

My Git tips, please check Git.

Install GitHub’s CLI (gh).

Change Your Name to yours.
Change [email protected] to yours.

git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.lp local-push
git config --global color.ui true
git config --global url."[email protected]:".insteadOf "https://github.com/"
git config --global core.editor "subl -w"
git config --global core.excludesfile ~/.gitignore_global
git config --global diff.noprefix true
git config --global hub.protocol https

prefer git url

Change [email protected] to yours.

ssh-keygen -t ed25519 -C "[email protected]"
eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/id_ed25519
pbcopy < ~/.ssh/id_ed25519.pub
open https://github.com/settings/keys

# test connection 
ssh -T [email protected]

~/.ssh/config:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519
  ServerAliveInterval 60
  ServerAliveCountMax 30
  TCPKeepAlive yes
  IPQoS=throughput

Please see my /use page.

Please see Visual Studio Code.

ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl "$(brew --prefix)/bin/sublime"

Oceanic Next Color Scheme with JetBrains Mono and Oxygen Mono font.

For more, please see my Sublime Text Tips.

$ zip -e file.zip file
Enter password:
Verify password:

Profiles > Keys > Key Mappings > Presets and use "Terminal.app Compatibility".

Then you can use ⌥+← to move back a word!

⌥+click and click at where you want the cursor.

⌘+space

Download Karabiner Elements, import rules for Japanese, then enable:

# ~/.inputrc
set show-all-if-ambiguous on
set completion-ignore-case on
set input-meta on
set output-meta on
set convert-meta off

"\e[5~": history-search-backward # fn + up
"\e[6~": history-search-forward # fn + down

https://support.apple.com/lt-lt/guide/mac-help/mchlp2322/mac

ffmpeg -i in.mov -vcodec libx264 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -pix_fmt yuv420p -strict experimental -r 30 -t 2:20 -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -ac 2 out.mp4

Turn off the built-in password manager in your browser

Get this Thunderbolt to Gigabit Ethernet Adapter.

Wiki: 10Gbps Ethernet

You need Mac that supports 10Gbps and cable that supports 10Gbps.

Macs that come with 10Gb Nbase-T:

Cables:

Wi-Fi6 / IEEE 802.11ax

If you see this after macOS upgraded, run xcode-select --install.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Signal (RSSI) values, the less negative, the better.
Noise values, the more negative, the better. -90 is pretty good. -80 ~ -100

sysctl

sysctl -n hw.ncpu

shasum -a 256 file.tar.gz

Read:

$ ioping -q -c 10 -s 8k .
9 requests completed in 193 us, 72 KiB read, 46.6 k iops, 364.3 MiB/s
generated 10 requests in 9.00 s, 80 KiB, 1 iops, 8.88 KiB/s
min/avg/max/mdev = 16 us / 21.4 us / 27 us / 4.45 us

46.6 k iops, 364.3 MiB/s

Write:

$ ioping -q -c 10 -s 8k -W .
ioping -q -c 10 -s 8k -W .

--- . (apfs /dev/disk1s2 1.82 TiB) ioping statistics ---
9 requests completed in 352 us, 72 KiB written, 25.6 k iops, 199.8 MiB/s
generated 10 requests in 9.00 s, 80 KiB, 1 iops, 8.89 KiB/s
min/avg/max/mdev = 27 us / 39.1 us / 57 us / 10.5 us

25.6 k iops, 199.8 MiB/s

brew install ffmpeg

Add a file list mp4s to merge in order:

file '1.mp4'
file '2.mp4'
file '3.mp4'
file '4.mp4'
file '5.mp4'

Then run:

$ ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4