2019-11-01: Added a pointer to installing a better dictionary.
I recently did a fresh install of macOS Mojave and documented a few things I did to set up my environment. Since I migrate between systems, I try to keep customizations minimal. The following are some of my working notes.
After installation:
- Tweak system preferences (Caps Lock as Ctrl, etc.)
- Keyboard: CapsLock remapped to Ctrl
- Spotlight: enable only Applications and Calculator
- Notifications: turn on Do Not Disturb for most of the day
- Fix washed out colors and blurry fonts
- Selected items from OS X for Hackers
- Install software
- Xcode (via App Store)
- Command Line Tools (
xcode-select --install
) - MacPorts
- Hammerspoon (desktop automation)
- Cisco VPN client
See further below for more details on certain items.
MacBook Air with Non-Retina Display and macOS Mojave
macOS Mojave on a MacBook Air (11-inch, Early 2015) (MacBookAir7,1) changes the colors on the display quite a bit: washed-out colors and blurry fonts.
There are various anecdotes and fixes on the internet, but I found that installing someone’s color profile and enabling heavy font smoothing works well:
defaults write -globalDomain CGFontRenderingFontSmoothingDisabled -bool NO
defaults write -globalDomain AppleFontSmoothing -int 3
The value for AppleFontSmoothing
is a number between 0-3, with 0 being
none and 3 being heavy.
Log out and log back in, or restart, to see the effects.
Adjust Sleep/Hibernate Settings
Putting the Mac into hibernation greatly prolongs the battery life as it consumes less power than sleeping.
Use pmset
to adjust the settings and timing delays.
This figure summarizes all
the relevant settings. If using battery power, we want to go into
hibernate immediately after 5 minutes:
sudo pmset -a standby 1
sudo pmset -a hibernatemode 25
sudo pmset -a sleep 5
sudo pmset -a proximitywake 0
sudo pmset -a ttyskeepawake 0
sudo pmset -a powernap 0
MacPorts
Installing MacPorts was a seamless process on Mojave. I generally use the latest versions of MacPorts from git (stable release versions are also available).
Install Xcode and the command line tools first, then the following snippet will get everything set up from git:
# macports core repo: /opt/macports-base/
# macports ports repo: /opt/macports-ports/
# default prefix is: /opt/local/
# prepare directory
sudo mkdir -p /opt
sudo chgrp staff /opt
sudo chmod g+w /opt
# clone core and ports repo, build core
git clone https://github.com/macports/macports-base.git /opt/macports-base
git clone https://github.com/macports/macports-ports.git /opt/macports-ports
cd /opt/macports-base
./configure --enable-readline
make && sudo make install && make distclean
# tell macports to use the ports repo
sudo echo "file:///opt/macports-ports [default]" > /opt/local/etc/macports/sources.conf
# set the PATH env variable to use MacPorts binaries first
echo "export PATH=/opt/local/bin:/opt/local/sbin:$PATH" >> ~/.bashrc
# first run will take some time, then MacPorts is ready to go
sudo port selfupdate
cleanup
MacPorts keeps a copy of distribution files under
/opt/local/var/macports/software
. This can be cleared out periodically
if you’re low on disk space.
Hammerspoon
Hammerspoon is a desktop automation tool that can be used as a window manager. You can create keyboard shortcuts via Lua to interact with the desktop; my use case is to primarily window management and placement. Those familiar with Xmonad or Fluxbox would find this tool useful.
Here is an example snippet to set a window to 50% width and move to the
left half of the display via Cmd-Shift-H
:
-- 50% width, left half
hs.hotkey.bind({"cmd", "shift"}, "H", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
I have corresponding shortcuts for the right half, varying widths, and so on. Find my configuration on GitHub.
Cisco VPN Client
It’s difficult to find a clean and reliable copy of the Cisco AnyConnect Secure Mobility Client publicly. Rather than providing you with an installer, most institutions will direct you to the web VPN client.
To get the installer at USC (if you’re affiliated with USC):
- Log in to the web VPN client at https://vpn.usc.edu but don’t let the Java applet run.
- The applet will fail to run, and the corresponding page will include a link to download the VPN client.
A Better Dictionary
- You’re probably using the wrong dictionary
- James Somers on why using Webster’s Unabridged Dictionary (1913) is better than dictionaries of today.
WebsterParser provides a dictionary converted from Project Gutenberg that you can drag-and-drop to install on macOS’s Dictionary.app.
Other Resources
- provisioning script: https://github.com/ptb/mac-setup
- fixing Time Machine backups:
- mirroring to Mac options (e.g., AirPlay from an Apple device to a Mac):