Set Up New Mac

I got a new Mac to go with the new job. Here’s rough notes on what I did to set it up.

    <h2>
      <strong>Open the box and plug it in.</strong>
    </h2>

    <p>
      Get it booted.
    </p>

    <p>
      Create a new apple id for the new job along the way. Get annoyed at Apple for not allowing a letter to be used more than 2 times in a row e.g. a password with &#8216;AAA&#8217; anywhere in it is not allowed. Just let me use whatever password I want.
    </p>

    <h2>
      <strong>Upgrade the OS</strong>
    </h2>

    <p>
      Update the OS from Catalina to Big Sur.
    </p>

    <h2>
      <strong>Configure Some Things</strong>
    </h2>

    <ul>
      <li>
        Make the touchpad NOT click on finger taps
      </li>
      <li>
        Get my standard set of images for the screen saver and set it up to show them
      </li>
      <li>
        Put the power saver settings the way I like them
      </li>
    </ul>

    <h2>
      <strong>Install All the Things</strong>
    </h2>

    <p>
      <strong>Chrome</strong>
    </p>

    <p>
      Install Chrome and set it as the default browser. Don&#8217;t @ me. This is the browser I use because it is the browser I use. I am not interested in browser wars.)
    </p>

    <p>
      <br />Create two user profiles in Chrome. One for work using the work email and one for personal using the personal email. This makes it easier to keep things with things while still making it not-too-bad to get at all my common tools using the chrome-synced manus, toolbars, and settings.
    </p>

    <p>
      <strong>Password manager</strong>
    </p>

    <p>
      Install my favored password manager because remembering passwords is hard work that no human should do.
    </p>

    <p>
      <strong>VSCode</strong>
    </p>

    <p>
      <br />Install VSCode. Install the key extensions.
    </p>

    <ul>
      <li>
        EditorConfig
      </li>
      <li>
        C/C++
      </li>
      <li>
        CMake Tools
      </li>
      <li>
        Docker
      </li>
    </ul>

    <p>
      <br />Realised I did not have all the extensions I expected on my personal machine. There are many that I used on my old work machine that are not yet there either. Awesome. Let&#8217;s guess what they are and install some of them on both machines.
    </p>

    <ul>
      <li>
        Python
      </li>
      <li>
        shellcheck (this will need some other things installed below)
      </li>
    </ul>

    <p>
      That&#8217;ll get the most likely ones. Others can be installed as I go along.
    </p>

    <p>
      <a href="https://code.visualstudio.com/docs/setup/mac" target="_blank" rel="noreferrer noopener" data-type="URL" data-id="https://code.visualstudio.com/docs/setup/mac">Configure VSCode</a> to allow <code>code</code> on the command line to open files.
    </p>

    <p>
      <strong>ITerm2</strong>
    </p>

    <p>
      Install ITerm2 and make its configuration match what&#8217;s on my personal machine.
    </p>

    <p>
      <strong>Set Shell</strong>
    </p>

    <p>
      Recall as some point that the newer MacOS versions default to <code>zsh</code>. Nothing against it, but I am sticking with <code>bash</code>.
    </p>

    <p>
      Big Sur still has <code>bash</code> in the <code>/etc/shells</code> so I just need to change the default shell
    </p>
  </div>
</div>
chsh -s /bin/bash

I will have to change this when I install the newer version of bash below.

    <p>
      <strong>Xcode</strong>
    </p>

    <p>
      <br />Putting this here even though I actually did it after <code>brew install pyenv</code> because I realized I would need the command line tools pretty soon.
    </p>

    <p>
      Use the App store to install XCode. Which required setting up the App store with the new Apple ID.
    </p>

    <p>
      Start XCode to click all the agree buttons.
    </p>

    <p>
      This version of XCode installed the command line tools by default so <code>xcode-select --install</code> did not have to do anything.
    </p>

    <p>
      <br />(Carry on with the Brew installs&#8230;)
    </p>

    <p>
      <strong>Homebrew</strong>
    </p>

    <p>
      Install homebrew.
    </p>

    <p>
      brew install all the things I use on my personal machine that look to be useful on the work machine.
    </p>

    <p>
      <br /><code>brew list</code> to get the list the cut it down to likely things<br />These are the important ones. These will get installed and configured now.
    </p>

    <p>
      <code>brew install magic-wormhole</code>
    </p>

    <p>
      Wonderful tool for moving things securely from one machine to another
    </p>

    <p>
      <code>brew install pyenv</code>
    </p>

    <p>
      (stop here uninstall it and go back two steps to install XCode and then the command line tools)
    </p>

    <p>
      use pyenv to install the most recent python (3.9.0 now) and set it as the global python
    </p>

    <p>
      <code>pyenv install 3.9.0</code>
    </p>

    <p>
      This failed with an ugly python error. After consulting the googles I <a href="https://www.gitmemory.com/joshfriend" target="_blank" rel="noreferrer noopener" data-type="URL" data-id="https://www.gitmemory.com/joshfriend">found this that worked</a>:
    </p>
  </div>
</div>
LDFLAGS="-L$(xcrun --show-sdk-path)/usr/lib" pyenv install 3.9.0
pyenv global 3.9.0 

brew install bash

    <p>
      Big Sur comes with bash 3.2 installed. I want something at >= 4.x. The personal machine has 5.0. After the install add the new bash to the <code>/etc/shells</code> file and set it with <code>chsh -s /usr/local/bin/bash</code>
    </p>
  </div>
</div>
brew tap homebrew/cask-fonts
brew install --cask font-fira-code

I like ligatures in editors. This is the font for that. Install the package then configure VSCode to use it and update settings for fonts

    <p>
      <code>Font Family: Fira Code </code>
    </p>

    <p>
      To enable ligatures, add this to the settings.json <code>"editor.fontLigatures": true, </code>
    </p>

    <p>
      <code>brew install git</code>
    </p>

    <p>
      Cannot live on a computer without it
    </p>

    <p>
      <code>brew install hub </code>
    </p>

    <p>
      <a href="https://hub.github.com/" target="_blank" rel="noreferrer noopener" data-type="URL" data-id="https://hub.github.com/">hub</a> makes working with Github nicer from the command line
    </p>

    <p>
      <code>brew install git-crypt</code>
    </p>

    <p>
      Which I use to encrypt secrets on some of my repositories
    </p>

    <p>
      <code>brew install shellcheck</code>
    </p>

    <p>
      <code>shellcheck</code> is a lint tool for bash scripts. I very much like running lint and other static checks on code I write in any language. <code>shellcheck</code> has proved itself in both catching subtle errors in my bash scripts as well as teaching me better ways to write bash. This package needs to be installed so the <code>shellcheck</code> extension of VSCode will work, which is where I use it most of the time. It also has a command line which lets it be added to build scripts. I highly recommend using it.
    </p>

    <p>
      There are some others that I will install later or as I find I need them:
    </p>

    <ul>
      <li>
        ccache
      </li>
      <li>
        gcc
      </li>
      <li>
        ninja
      </li>
      <li>
        xz
      </li>
      <li>
        cmake
      </li>
      <li>
        gdbm
      </li>
      <li>
        jq
      </li>
      <li>
        kdiff3
      </li>
    </ul>

    <h2>
      <br /><strong>Dot Files</strong>
    </h2>

    <p>
      <br />I have a repo full of dot files to bootstrap a bunch of configurations. I&#8217;ll get that down and put them where they belong.
    </p>

    <p>
      <br />Create a <code>~/projects/</code> folder, because that&#8217;s what I do.
    </p>

    <p>
      Clone the <code>dotfile</code> repository.
    </p>

    <p>
      Which requires telling GitHub about my new machine. Which means <a href="https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent" target="_blank" rel="noreferrer noopener" data-type="URL" data-id="https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent">creating a new ssh key </a>and putting it in all the places.
    </p>
  </div>
</div>
mkdir ~/.sshcd ~/.sshssh-keygen -t ed25519 -C "your_email@example.com"
eval "$(ssh-agent -s)"
# update the ~/.ssh/config file with a Host
blockssh-add -K ~/.ssh/id_ed25519
# add the key to Github
git clone <dotfiles repo>`

From the dot files:

    <ul>
      <li>
        Copy the ssh config parts that a generic into the <code>~/.ssh/config</code> file.
      </li>
      <li>
        Copy The bash files that are useful. There might be bits in these that don&#8217;t apply yet because something is not install, but it should be harmless to have it there early.
      </li>
      <li>
        <code>.bash_profile</code>
      </li>
      <li>
        <code>.bashrc</code>
      </li>
      <li>
        Copy all of the git config files that are useful (some are specific to old git repositories that are no longer needed)
      </li>
      <li>
        Copy all the other dotfiles that are there (vim, input, kdiff)
      </li>
    </ul>

    <p>
      There are also some VSCode settings files cached here, but I will look at those and probably manually echo the settings instead of risking copying them blindly.
    </p>

    <h2>
      <strong>Utility Scripts</strong>
    </h2>

    <p>
      I have a big pile of utility scripts, mostly in bash, in a git repository. Clone that repository down.
    </p>

    <h2>
      <strong>Sundry Tools</strong>
    </h2>

    <p>
      <strong>Rogue Amoeba Tools</strong>
    </p>

    <ul>
      <li>
        Loopback
      </li>
      <li>
        Hijack
      </li>
      <li>
        SoundSource
      </li>
    </ul>

    <p>
      I have found these to be very useful for managing sound and sound-devices on the Mac.
    </p>

    <h2>
      <strong>Enough for Today</strong>
    </h2>

    <p>
      That gets the machine into basic working shape. That took about 4 hours.
    </p>

    <p>
      Still left to do are things like
    </p>

    <ul>
      <li>
        get gcc installed (so I can keep working on my Advent of Code)
      </li>
      <li>
        get java installed (i&#8217;ll probably wait to make sure I get the one needed for the client gig)
      </li>
      <li>
        getting the desktop apps for some of the office tools (outlook, miro, etc.)
      </li>
    </ul>

    <p>
      I&#8217;ll write about those if anything special happens during the installs.
    </p>
  </div>
</div>