Table of Contents

Apple

First time configuration of a new Macintosh. Updated for macOS Sierra 10.12

Configuration

Tools Installation

The old way of installing Command Line Tools from the Terminal doesn't work anymore. But now it can be done from the Developer download site, not from the Terminal.

BSD vs. Linux commands

macOS comes with BSD grep pre-installed, which doesn't use the Perl -P flag.

Go to http://brew.sh/ and run the ruby command. (See this .bash_profile change for how we use default names for GNU ctags, find, grep and sed.)

brew install grep
brew install gnu-sed
brew install findutils
brew install ctags
brew install gawk
brew install jq
brew install tree
brew install httpie
brew install inetutils  # If you need telnet (maybe nc is good enough?)
brew install telnet
brew install gnuplot
brew install pv
brew install gnupg
brew install socat
brew install wget
brew install nmap
brew install tmux
brew install saulpw/vd/visidata
brew install ripgrep
brew install moreutils
brew install bash-completion. " See .bash_profile
brew install gitui
# Maybe also readline if you brew install python3

brew install bash
# Note where it was installed. Then something like...
sudo ln -s /opt/homebrew/Cellar/bash/5.2.15/bin/bash /usr/local/bin/bash
sudo echo /usr/local/bin/bash >> /etc/shells
chsh -s /usr/local/bin/bash

Log out of that console window and log back in again.

tmux and "tmux-256color"

We set tmux to set $TERM to “tmux” so that neovim's highlight can include italics. And we bump it to “tmux-256color” so that VisiData can make use of all its colors. (Dot plot AirPassengers.csv but don't set the month column to any format.)

VisiData will complain it “could not find terminfo database”. So we manually use the one provided by a tmux developer

curl -O "https://gist.github.com/nicm/ea9cf3c93f22e0246ec858122d9abea1/raw/37ae29fc86e88b48dbc8a674478ad3e7a009f357/tmux-256color"
sudo tic -x tmux-256color

That should install the database into /usr/share/terminfo

Tips

Shortcut Action
Command+space Spotlight (Very handy!)
Command+W Close the window.
Command+Q Quit the application. (Closing its windows isn't enough.)
Command+click Open the link in another tab.
Command+Tab Switch between applications.
Command+` Switch between windows within the application.
Command+Opt+Esc Force Quit the application
Shift+Opt+Command+V Paste without formatting

Daemons, Agents, Cron, Launchd

The preferred way to set a repeating task is not to use a cronjob but launchd. :!: Note that there's a breaking change in macOS Catalina. Launchd agent no longer functions after Catalina upgrade.

In your ~/bin directory, create a job to run, tag_ip_address.sh

tag_ip_address.sh
#!/usr/bin/env bash
curl --data "`hostname -s`=`ifconfig | /usr/local/bin/grep "inet " | grep -v "127.0.0.1" | \
sed -E 's/.*inet (([0-9]+.){3}[0-9]+).*/\1/' | perl -p -e 'chomp if eof;s/\n/,/'`&auth=[your secret auth]" "https://kvs.dlma.com"
 
sleep 11  # if launched as a daemon, live for 11s to not be detected as buggy.

That “sleep 11” is to mitigate the buggy daemon detection mentioned here.

Note that we had to specify the path to the homebrew grep, because LaunchAgent would use the default one instead.

cd into ~/Library/LaunchAgents or (/Library/LaunchDaemons if it can really be a daemon) and add a new plist file

com.dlma.tag_ip_address.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
        <string>com.dlma.tag_ip_address</string>
    <key>Program</key>
        <string>/Users/dblume/bin/tag_ip_address.sh</string>
    <key>StandardOutPath</key>
        <string>/tmp/com.dlma.tag_ip_address.plist.out.txt</string>
    <key>StandardErrorPath</key>
        <string>/tmp/com.dlma.tag_ip_address.plist.err.txt</string>
    <key>StartCalendarInterval</key>
        <dict>
            <key>Hour</key>
            <integer>12</integer>
            <key>Minute</key>
            <integer>0</integer>
        </dict>
</dict>
</plist>

Finally, you need to explicitly load it.

$ launchctl load -w /Library/LaunchDaemons/com.dlma.tag_ip_address.plist

Software to Get

Danelope suggests these Image Editors in 2011:

Preferences I don't set anymore

iOS Apps

Here are iPhone/iPod apps I really want to make.

Sokoban

Sokoban: Plenty already exist. What matters here is an intuitive (to me) user control.

Scrobbler

What matters here is the ability to scrobble what I've played to last.fm directly from my iPhone/iPod.

Prey

https://panel.preyproject.com/ for when the device goes missing. (Or is stolen by a thief.)

NFS for macOS

On the server side get your user ID and group ID (id -u; id -g), and update /etc/exports with something like:

/path/to/share 10.?.?.?(rw,sync,insecure,all_squash_anonuid=<uid>,anongid=<gid>)

10.?.?.? would be the IP of the Macintosh. (That'll have to be updated every time it changes.) For a Macintosh to connect, “insecure” was said to be needed. And “all_squash” was needed for the uid and gid to be set. Restart and check the NFS server with “sudo systemctl restart nfs-server.service; systemctl status nfs-server.service”.

Get the “hostname” for the server for the next bit on the client side. Call it jdoe-t3610.

On the client side, you could manually mount the NFS volume with something like, “nfs://jdoe-t3610/path/to/share”

Or better, configure automounter by adding a line to /etc/auto_master:

/-			auto_sandbox	-rw

And then make the file /etc/auto_sandbox

/sandbox	nfs://jdoe-t3610/path/to/share

For the purpose of P4 client compatibility with the dev system, I use a symbolic link at root.

$ sudo ln -s /sandbox/sandbox/stb/ /link_to_p4_root

If you want your changes to take effect immediately,

$ sudo automount -vc

Keywords

aps, todo