mmap.page

macOS Survival Guide

Create a Bootable Installer

I created a bootable installer to install macOS offline, incase that something went wrong macOS can be installed from Internet in recovery mode, but it is unreliable and slow. I first tried a Sandisk 16GB USB drive, and it failed during copying the installer content. Then I tried a Toshiba 32GB USB drive, and the creation succeeded. I am not sure if 16GB is too small or macOS installer is fussy on USB drive models.

Install Linux

I always feel that I can only own a computer truly after I have installed Linux on it. So after finishing the macOS initial setup (user account, etc.), I rebooted to the recovery mode (Command+R on Intel based Macintosh machines with a T2 chip).

Then I added a partition via disk utility in the recovery mode. This partition is for Linux, so the format does not matter. Adding a new partition will automatically resize the current macOS partition, which is much slower if performed under macOS instead of recovery mode.

I also disable secure boot and enable external boot.

Then I just booted into the installation USB drive, and installed EndeavourOS. I chose the replace partition option with encrypted file system. The installer set up LUKS encryption and ext4 automatically. If I had chosen the "erase all" option, I can do some customizations, such as ext4/btrfs, swap partition/file, etc. However, I need a dual boot machine.

I started the mac holding down the option key. The startup manager displayed. I used the arrow key to select the EFI disk for Linux, then I pressed enter and booted into EndeavourOS sucessfully.

After finished initial setup of EndeavourOS, I started the mac holding down the option key again. While holding the Control key, I chose to boot into macOS, which also made macOS the default startup disk.

Enable TouchID for sudo

Add auth sufficient pam_tid.so in /etc/pam.d/sudo.

Set Timezone to GMT

I am frustrated to dealing with timezones. Why not everyone uses UTC+0?

sh
sudo systemsetup -settimezone GMT

And got a -99 error. But it seems that the timezone has changed to GMT.

sh
; sudo systemsetup -gettimezone
Time Zone: GMT

For safety, I untick the "Set time zone automatically using current location" option in "System Preferences > Date & Time > Time Zone".

Install Homebrew

The Homebrew installer script will install Command Line Tools for Xcode automatically.

After installation, turn off analytics:

sh
brew analytics off

With all the software I need listed in ~/.Brewfile, I typed brew bundle --global to install them all.

Install ExtFS

I tried to install Paragon ExtFS for ext{2,3,4} read/write support via homebrew:

sh
brew install paragon-extfs

Homebrew reports the installation succeeded, but I can not find the extF application. Thus I manually opened the installer in /usr/local/Caskroom/paragon-extfs/latest/ to install ExtFS. I allowed ExtFS in Settings > Security & Privacy, and restarted the system as ExtFS installer required. After that, I tried mounting a ext4 removable drive and succeeded.

Keyboard

In System Preference > Keyboard > Modifier Keys, I set CapsLock as Esc.

I also installed AltTab to switch applications with alt-tab.

By the way, OS X has native system-wide support for some Emacs keybinds, e.g.

Command Key Alternatives
beginning-of-line ^a <D-Left>
end-of-line ^e <D-Right>
previous-line ^p <Up>
next-line ^n <Down>
forward-char ^f <Right>
backward-char ^b <Left>
delete-char ^d N/A
backward-delete-char ^h <Delete>
transpose-char ^t N/A
kill-line ^k N/A
yank-line ^y N/A
insert-line ^o N/A
page-down ^v <Fn+Down>
recenter ^l N/A

And there are some keybinds slightly different the original Emacs keybinds:

However, my keyboad has arrow keys and I feel using arrow keys are more nature.

Trackpad

In System Preferences > Trackpad:

Turn off Internal Display

When the power adapter is connected:

  1. Close the lid to put laptop to sleep.
  2. Reactivate laptop via external input devices, e.g. keyboard.

Tiling

Long press the restore button, then select tiling in drop-down menu.

Another way is activating mission control. Then move one window to another full screen window in another virtual desktop.

Drag the edge between two tiling windows to adjust the size of the two windows at the same time.

Rectangle offers more advanced manual tiling features.

Virtual Desktops

Press Ctrl-Left/Right or swipe three fingers from left to right to switch among virtual desktops.

Press Ctrl-Up/Down to show an overview of desktops or go back to normal mode.

Finder

By default, ~/Library is hidden. To reveal it in Finder temporarily, hold the Option key, then click the Go menu, and the Library folder is revealed in the dropdown menu.

To permanently reveal the Library folder in Finder, run the following command:

sh
chflags nohidden ~/Library/

BTW, most applications' user configuration files are in ~/Library/Application Support.

Safari

To enable developer tools, select "Show Develop menu in menu bar" in Safari > Preferences > Advanced. You can also change the default encoding to UTF-8.

There are several vi shortcuts extensions for safari, for example, sVim.

sVim can be configured via sVimrc via the extension settings in Safari. I mapped d and D to close and undo close tab:

" Shortcuts

map "d" quit
map "shift+d" lastClosedTab

Google

Google accounts can be added to the Mail.app. Besides gmail, other osx applications can also sync with Google account: