so

Rebuilding it from scratch

Volume 3, Issue 12; 25 Mar 2019

A few notes on the setup and configuration of a laptop.

Consistent with my plan to develop new, productive habits this year, I took notes while I was in the process of rebuilding my laptop configuration from scratch (three times) this week. I decided to reformat them slightly and plonk them down here for all to see. If this is the sort of thing that interests you, here it is. If it’s not, now would be a good time to wander off and find something else to do.

It’s worth noting from the outset that my laptop configuration is a bit weird. There are a few reasons for that:

  1. I don’t trust system restores. I have backups of various sorts, including Time Machine and so forth, but if I get a new laptop, I always start with a clean OS install and rebuild from scratch. I had to use a Windows laptop in the late nineties. It taught me a couple of lessons: restore doesn’t work and doing a clean install annually will keep Windows working smoothly.
  2. I’m slightly irked by the preferential treatment of folders named “Documents”, “Downloads”, “Movies”, and the like. I know what I’m doing, leave me alone.
  3. I switch platforms occasionally; exactly which folders are special and in exactly what ways isn’t obvious to me. And since I don’t appreciate the effort, I’ve no interest in figuring it out.

Basically, the less my stuff overlaps with the stuff that the OS believes it wants to manage, the better.

Beyond the OS directories (/Users or /home, depending, and /Applications, /usr/local, etc.), there are three big buckets: /space, which was, in a previous laptop, actually a separate physical disk, /projects, under which most of my personal projects live, and /MarkLogic, a separate APFS volume with a case sensitive filesystem.

My pictures, documents, shell scripts, libraries, etc., live under /space/ndw. Moving to a new laptop is 90% copying those three buckets to the new machine.

Here’s a rundown of the other 90%, per recent experience, as it’s recorded now. I’m sure my notes will get a few updates as I settle into this new laptop. Every build that uses node or gradle or sbt is going to be trying to download half the internet for a while.

Basic setup

  • Make a second Administrator account. This is the one I can login to if I totally break something in my normal login, or if I suspect that some extension or application might be causing problems. I never install things here or run things here, this is just an escape hatch. I call mine “John Bigboote”.
  • Make “caps lock” a “control” key.
  • Remove the keyboard shortcuts for spotlight search.
  • Move the dock to the right, make it auto hide, remove everything I can from it.
  • Remove siri from the touchbar.
  • Change the wallpaper to plain gray.
  • Enable remote login.
  • Enable firewall.
  • Enable locate: sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
  • Configure VPN.

Install applications

  • Alfred. Do this one first. Make ⌘+Space the shortcut key. Thank $DEITY now you can start applications without fumbling about with icons or the annoying “Finder” interface.
  • Emacs. Do this one second. Because otherwise you have to edit files with something else.
  • iterm2. Do this one third. It’s a better terminal. Preferences are stored in ~/Library/Preferences/com.googlecode.iterm2.plist. Copy that file from the previous laptop and restart to activate them.

The rest of these you can do in any order that pleases you.

  • Moom. Sensible choices for controlling windows. I haven’t taken the time to really configure it yet, but I use “maximize to half the window” all the time.
  • IntelliJ IDEA. My editor of choice for Java and Scala, the only two things I don’t edit in Emacs.
  • Keybase. For private communications. I’m ‘ndw’ if you want to connect.
  • Docker. Containerize all the things. In particular, it’s how I build and run MarkLogic server.
  • ExpanDrive. I got a license for this years ago when I had to deal with WebDAV. It does lots of kinds of drive connections, but I haven’t used it much recently.
  • Dropbox. I use it to capture photos from my phone and to share Org files across devices.
  • Little Snitch. Keeps track of network connections. You’d be amazed. It can also block and filter them.
  • Micro Snitch. Reports when the camera or microphone are hot.
  • iStatMenus. Keeps track of memory usage, CPU speed, and the like.
  • VueScan. For scanning.
  • Kaleidoscope. A versatile diff tool for text, images. etc. I use it’s command line app as my git ‘difftool’.
  • Adobe Creative Suite. Lightroom and Photoshop.
  • Microsoft Office 365. Because a few times a year I actually have to.
  • VirtualBox. For when you absolutely have to run Windows. And sometimes a Linux flavor.
  • Homebrew. For most things Linux on the Mac.
  • Malwarebytes Antivirus. I haven’t typically run one on my Mac, but things are getting worse out there. This one came highly recommended.
  • Mullvad VPN. This one also came highly recommended. For when you need one.
  • Oracle Java 8. A bit behind the times, but I haven’t made the cognative leap of working out where to go next.

Install packages

Here I’m relying on Homebrew. Next time I’m doing this dance with the luxury of a little more time, I want to try using Nix instead. I really like the Nix philosophy. I did use a mixture of Nix and Homebrew for a time, but some of the Nix utilities didn’t seem to work quite right and I had qualms about having two package managers mixed together, so I abanoned Nix on this iteration.

brew install ack asciidoctor aspell bat boost cmake coreutils \
     curl davmail exa findutils fzf getmail gmime gradle htop \
     icu4c igraph jq ledger libtool maven mercurial nave notmuch \
     pandoc perl pinentry-mac procmail pyenv pyenv-virtualenv \
     python3 sbt shared-mime-info the_silver_searcher tmux travis \
     zlib

I don’t use Maven directly, but I have a Perl library that will use it to download dependencies so I can run things like Calabash from the command line and get the right dependencies.

brew tap homebrew/cask-fonts
brew cask install font-hack-nerd-font font-iosevka font-cardo

Setup Python

  • Use pyenv to install 3.7.1
  • Set 3.7.1 as the global python
  • pip install powerline-status (not powerline!)
  • pip install powerline-shell requests requests_toolbelt tzlocal icalendar
  • Install icalevents from /projects/python/

Setup Perl

Use CPAN to install File::MimeInfo, Image::Size, LWP, LWP::Protocol::https, Mozilla:CA, YAML::XS, and XML::XPath. I’m sure I’ll discover more things that I need to install as the days and weeks go by.

Fix my login

Now that all the prerequisites are in place, it’s time to fix my login shell.

  • Install Oh My ZSH!
  • Copy ~/dotfiles from my old config and make symlinks for everything in there (.zshrc, .zshenv, .zsh_functions, .procmailrc, .netrc, .aspell.conf, etc., etc., etc.)

Setup exim

Whoo boy.

Setup getmail

  • Create /usr/local/var/spool/mail/ndw
  • Make sure procmail is correct in ~/dotfiles/getmail/*.rc

Setup Apache

Copy over the http.conf file

Install crontab

My procmail recipes create backup copies of messages and filter certain messages into a spam bucket. My crontab makes sure nothing sits around for more than a week. I also constuct an Emacs diary file from my Apple calendars.

Install sudoers files

I make it possible to run apachectl, htop, and a shell script that does ifconfig lo0 alias commands for Docker containers using sudo without a password.

Install /etc/hosts

I have an /etc/hosts file that points to a bunch of local hosts (raspberry pi’s and the like) plus a bunch of docker containers.

Setup firefox extensions

This is still T.B.D. today. I failed to note what I had installed and I haven’t gone spelunking through my saved home directory to work it out.

Comments

"Preferences are stored in ~/Library/Preferences/com.googlecode.iterm2.plist. " Implies you 'need' config files across new machines? Why not have a backup script that collates them and their location? Nothing in $HOME or /etc in the same category?

I've another (order based). A bash script (not used as such) which reminds me about install order, changes needed (e.g. config). This is my 'readme' on a new install.

—Posted by Dave Pawson on 25 Mar 2019 @ 07:54 UTC #

I only mentioned the iterm plist file because I can never remember where it is. That's where iterm stores things like my profiles (so I can open a "presentation" terminal window with a big font automatically, etc.) Yes, there are other settings that need to be copied over, I guess I didn't go into the goriest of detail.

There's a step where I look at every file and directory in the "old" home directory and see if it exists in the "new" home directory and decide what needs to be copied and what I need to just let get recreated.

I could automate more of it, and by the third time I was doing it, I wished that I had! But it would take a long time to setup and test and I fear the scripts would grow stale fairly quickly as I add/change apps and configurations. Given that I only (I hope!) do this once very few years, having detailed notes is enough, I think. That saves me from having to reinvent the process every time, anyway.

Please provide your name and email address. Your email address will not be displayed and I won’t spam you, I promise. Your name and a link to your web address, if you provide one, will be displayed.

Your name:

Your email:

Homepage:

Do you comprehend the words on this page? (Please demonstrate that you aren't a mindless, screen-scraping robot.)

What is seven times six?  (e.g. six plus two is 8)

Enter your comment in the box below. You may style your comment with the CommonMark flavor of Markdown.

All comments are moderated. I don’t promise to preserve all of your formatting and I reserve the right to remove comments for any reason.