2019-05-23: I’ve migrated to macOS 10.14 Mojave and documented my setup here.
I recently did a fresh install of OS X Yosemite and documented a few things I do 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.)
- Restore privacy (disable “Spotlight Suggestions” and “Bing Web Searches”)
- Selected items from OS X for Hackers
- Install iTerm2, Hammerspoon, Command Line Tools and XCode, MacPorts, TextMate 2.0 (beta), MacTex, and Cisco VPN client.
- Transfer Microsoft Office 2011 activation/installation.
See further below for more details.
MacPorts
Installing MacPorts from source via SVN causes some initial problems with certificate verification:
$ sudo port -d selfupdate
...
svn: E175002: Unable to connect to a repository at URL
'https://svn.macports.org/repository/macports/trunk'
svn: E175002: OPTIONS of 'https://svn.macports.org/repository/macports/trunk':
Server certificate verification failed: issuer is not trusted
(https://svn.macports.org)
Command failed: /usr/bin/svn update --non-interactive /opt/macports-trunk/dports
This is a bug that’s caused by Apple’s SVN not containing various Certificate Authorities. I wasn’t able to solve this by manually adding the certificate, despite doing it multiple attempts under different users.
The fix is to switch to temporarily to rsync for the ports tree sources, install svn, then switch back to svn.
Edit /opt/local/etc/macports/sources.conf
and ensure that the only source is:
rsync://rsync.macports.org/release/tarballs/ports.tar [default]
Run:
sudo port selfupdate
sudo port install subversion
Then edit sources.conf
, comment out the line with rsync, and replace it with
the following (or wherever your ports tree is located):
file:///opt/macports-trunk/dports [default]
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. (I’ve previously used Slate, but the application is no longer maintained).
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 in git.
Transfer Office 2011 Installation
I needed to transfer an Office install without installation media or serial key. Luckily, Microsoft provides all the installation media online via Digital River. A list can be found via Heidoc; most will probably use English/USA Office 2011 SP2.
Install Office, then transfer the following files from your old installation or backups to your new Mac (via StackExchange):
/Library/LaunchDaemons/com.microsoft.office.licensing.helper.plist
/Library/PrivilegedHelperTools/com.microsoft.office.licensing.helper
/Library/Preferences/com.microsoft.office.licensing.plist
Cisco VPN Client
It’s difficult to find a clean and reliable copy of the Cisco AnyConnect Secure Mobility Client. Rather than providing you with an installer, most institutions will direct you to the web VPN client.
To get the installer at 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.
QuarantineEvents Privacy
OS X keeps a log of what you’ve downloaded and will show a warning the first time you run an application.
To disable this, run the following in a terminal:
defaults write com.apple.LaunchServices LSQuarantine -bool false
See what’s being stored by using sqlite3
and this snippet:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 \
'SELECT datetime(LSQuarantineTimeStamp + 978307200, "unixepoch") as
LSQuarantineTimeStamp, LSQuarantineAgentName,
LSQuarantineOriginURLString, LSQuarantineDataURLString from
LSQuarantineEvent' | sort | less
If you’re curious about the schema:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
LSQuarantineEvent
sqlite> .schema
CREATE TABLE LSQuarantineEvent ( LSQuarantineEventIdentifier TEXT
PRIMARY KEY NOT NULL, LSQuarantineTimeStamp REAL,
LSQuarantineAgentBundleIdentifier TEXT, LSQuarantineAgentName TEXT,
LSQuarantineDataURLString TEXT, LSQuarantineSenderName TEXT,
LSQuarantineSenderAddress TEXT, LSQuarantineTypeNumber INTEGER,
LSQuarantineOriginTitle TEXT, LSQuarantineOriginURLString TEXT,
LSQuarantineOriginAlias BLOB );
CREATE INDEX LSQuarantineEventIndex ON LSQuarantineEvent (
LSQuarantineEventIdentifier );
Finally, clean up:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 \
'delete from LSQuarantineEvent'
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 \
'vacuum'