razzi.abuissa.net

Razzi guide to macOS

Enable quitting Finder

Each time I set up a Mac, I want to enable quitting Finder:

defaults write com.apple.Finder QuitMenuItem -bool YES

You won’t be able to quit Finder immediately, so kill it manually:

killall Finder

It’ll reopen but you can then command+tab over to it and command+q to exit.

Install Homebrew

If you head to https://brew.sh it’ll tell you to copy and paste their install command into the terminal. I’m not super paranoid but I like to inspect scripts from the internet before running them.

So I download the install script and look at it. You can also shasum it:

razzi@Razzis-MacBook-Air ~ % cd ~/Downloads
razzi@Razzis-MacBook-Air Downloads % curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh > install.sh
razzi@Razzis-MacBook-Air Downloads % sha256 install.sh
SHA256 (install.sh) = ec86e15f442810fbed79fd1231ef796048dbf3f4ef2103a0e03d5c564448b12a

Then when I’m content I run it like so:

razzi@Razzis-MacBook-Air Downloads % bash install.sh

It’ll do various things including installing the command line tools (git, clang) and its own brew command.

At the end it tells you to modify your profile script like so:

==> Next steps:
- Run these commands in your terminal to add Homebrew to your PATH:
    echo >> /Users/razzi/.zprofile
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/razzi/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"

I use the fish shell, so I don’t see any point in modifying my zsh environment; I’d rather install fish and start using that.

That exact shell that installed homebrew will not have the brew command until you run those commands; however the next one you make will have it from this path file: /etc/paths.d/homebrew.

Let’s take a moment to customize the terminal appearance and behavior, then you’ll have a nice looking shell that also has brew.

If you want that exact shell to work with homebrew, you can exec zsh --login

Customizing the terminal

Hit command+, (command comma) to open the Terminal.app settings.

All the settings I’m interested in are under the Profiles tab.

To customize your terminal’s appearance, you can edit your Default profile, or change your profile to another one by selecting that one and clicking Default at the bottom.

The main thing I recommend is to make the font much larger. Now that computer screens have gotten quite pixel-dense, a 12-point font is really tiny. So I make my terminal’s default font size 18:

The other setting I recommend is Profiles > Shell > When the shell exits; the default is “Don’t close the window” but I set it to “Close the window”.

You may occasionally realize that you want to look back at some output after you hit a final control+d to close the terminal, but I prefer to only send control+d once I’m ready to exit the terminal window. With the default behavior it will say “Process completed” after the final EOF and you won’t be able to send any more commands. Nah I say, just clean it up.

At this point, you can open a new terminal with command+n and see your new settings. We can also use the brew command.

Installing fish

brew install fish

Run the following commands to make fish your default shell. Not recommended if you don’t know what this is doing.

$ which fish | sudo tee -a /etc/shells
$ chsh -s $(which fish)

Enabling sudo without password

Run sudo visudo. You’ll have to enter your password one last time.

Look for the line that looks like:

%admin          ALL = (ALL) ALL

Change it to:

%admin          ALL = (ALL) NOPASSWD: ALL

Since I keep my whole computer locked by a password, I don’t feel the need to constantly type my sudo password. Maybe for a work computer with access to other people’s data I’d skip this… but it saves a lot of password typing.

add ~/.local/bin to PATH

I add this to my ~/.profile (this won’t do anything unless you add fish config to source your profile):

export EDITOR=vim

fish_add_path ~/.local/bin

I exec fish to apply this change in the current session:

$ exec fish

Then I make this directory:

$ mkdir ~/.local/bin

One way this comes in handy is to make the homebrew vim version take priority over the macOS vim.

Homebrew vim takes priority when I put it in my ~/.local/bin:

$ symlink /opt/homebrew/bin/vim ~/.local/bin/

At this point, my command line is pretty much set up, and I move on to customizing specific terminal programs with my dotfiles.

There is more bootstrapping to do, such as gpg and pass; I generally set up those programs as I need.

Other settings: increase the keyboard repeat rate

I like being able to hold j in vim and have the cursor quickly move down the screen, same for holding other letters with other motions.

You can do this in the built-in keyboard settings can do this just fine:

aside: taking nice screenshots of macOS windows

To take nice screenshots like the one above, press Cmd+Shift+4 then space to make it window screenshot mode and click on the window.

There’s also Cmd+Shift+3 to take a full screen screenshot.


There’s more to MacOS: apps I use like Karabiner-Elements and Rectangle, and a whole bunch more packages I install with the Brew package manager. But this is a start!