Macbook Setup

Published on 18 May 2022 • Updated 9 Apr 2024

Tweet

Follow the guide below to set up your new Macbook with necessary

tooling and other interesting packages. The content below is a dump from my personal notes wherein I attempted to keep my new Macbook deterministic (without using NixOS) by logging everything that I was installing, configuring and removing from the system. This is NOT a prescriptive guide, rather a collection of good suggestions - choose what fits you best. Have fun!

If any instruction is outdated or incorrect or if you have suggestions for a new entry, please open a PR here (under "page-src/notes").

Get started

  1. Set the keyboard from "System Preferences" - use Tab as "Ctrl" key.
  2. Set the keyboard from "System Preferences" - use English ABC Extended (or your preferred language).
  3. Clean up the desktop menu - remove stuff you don't need.
  4. Log in to the App Store with your new or existing Apple ID.
  5. Open Settings and update the computer name for access by outsiders. Something like "my-name.local" is recommended.
  6. Enable ssh as well.
  7. Install brew:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  8. Ensure brew is updated:

    brew update
    brew tap homebrew/cask-versions
    brew upgrade
    

Install browsers

  1. Open Safari and install Firefox and/or Brave browsers.
  2. (Optional but not recommended) Install Chrome Dev with brew install --cask google-chrome-dev.
  3. Install Tor Browser with brew install tor.

SSH Keys

Set up SSH keys as follows:

ssh-keygen -t ecdsa -b 521 -N '' -f ~/.ssh/id_ecdsa
ssh-add ~/.ssh/id_ecdsa

Optionally, if you need to add the public key to a host, run:

ssh-copy-id -f -i path/to/pubkey username@remote_host

Also, add ssh pub keys to Gitlab and/or Github. Don't forget to backup the private key safely.

Set up Git & other useful tooling

  1. First, install GNU Stow with brew install stow.
  2. mkdir -p ~/Workspace ~/Workspace/work ~/Workspace/play ~/Workspace/vendor
  3. cd ~/Workspace/play
  4. git clone https://github.com/bitsofparag/dotfiles.git
  5. Symlink the git config files from the just-downloaded dotfiles repo:

    dotfiles=/path/to/dotfiles
    stow -d $dotfiles -nvt ~ gitconfig # dry run
    stow -d $dotfiles -vRt ~ gitconfig
    
  6. Install git extras with brew install git-extras. See commands here.
  7. Install fancy diffing with brew install diff-so-fancy.
  8. Install fancy quick-to-read man pages utility with brew install tldr.
  9. Install Cookiecutter with brew install cookiecutter.
  10. (Optional) Install updated Gem from brew with brew install gem. Make sure the correct ruby version is picked up in $PATH. Normally brew installs gem in /usr/local/opt/ruby.
  11. If you installed the ri docs as well, then remove all docs with rm -r "$(gem env gemdir)"/doc/*.
  12. (Optional) Install Fastlane with gem install --user-install fastlane -NV.
  13. Install make essentials with brew install pkg-config automake.
  14. Install jq with brew install jq.
  15. Install yq with brew install yq.

Shell setup

There are many good terminal emulators out there, such as ZSH, Fish, xTerm etc. Choose what you're most comfortable with. This guide will set up ZSH on top of iTerm2.

  1. Open Terminal and install brew install --cask iterm2.
  2. Open iterm2 and set to zsh by: chsh -s /bin/zsh.
  3. Check $PATH. It should be something like

    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    
  4. Remove /etc/paths file.
  5. Install a good, legible font. IBM Plex Mono and Jetbrains Mono are two of my favorites. Set the iTerm font as well.
  6. Install "Oh My Zsh" - sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)".
  7. Install syntax highlighting plugin:

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
        ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    
  8. Similarly, install and activate zsh autosuggestions:

    git clone https://github.com/zsh-users/zsh-autosuggestions \
        $ZSH_CUSTOM/plugins/zsh-autosuggestions
    
  9. Install fzf.
  10. Install fzf keybindings - /usr/local/opt/fzf/install.
  11. Symlink zsh config files with functions

    stow -d $dotfiles -vRt $HOME zsh
    
    cat <<EOF > $HOME/.zshenv
    source $HOME/.zshenv.common
    EOF
    
    cat <<EOF > $HOME/.zshrc
    source $ZSH/oh-my-zsh.sh
    source ~/.zshrc.common
    EOF
    
  12. Install bat to replace cat: brew install bat.
  13. Install CMatrix for fancy clear command (which should be aliased already in the dotfiles; see step 21.)
  14. Install tree with brew install tree.
  15. Install fswatch with brew install fswatch.

Node and NPM setup

I am not a big fan of NPM. But sometimes I have to use NPM in order to collaborate with other devs or run node packages. Therefore, to prevent me from hurling the laptop at the wall, I chose to work with pnpm and Volta - keeps things sane and simple. Alternatives to them would be either NVM or n.

  1. Install Volta via brew: curl https://get.volta.sh | bash. The installation will automatically add entries to the shell profile, like so:

    export VOLTA_HOME="$HOME/.volta"
    export PATH="$VOLTA_HOME/bin:$PATH"
    

    Install the lts and the latest versions of node:

    volta install node@lts  # installs lts
    volta pin node@lts
    volta list
    
  2. Install Deno with brew install deno.
  3. Install pnpm with curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm.
  4. (Optional) Install global packages:

    pnpm add -g @storybook/cli \
        eslint \
        js-beautify \
        prettier \
        import-js \
        http-server \
        typescript typescript-language-server \
        dockerfile-language-server-nodejs \
        bash-language-server \
        @cloudflare/wrangler \
        semver
    
  5. Check the packages installed globally:

    pnpm ls -depth=0 -g
    
  6. (If n is installed) If you have other node versions, copy the same packages over with:

    n install <version> --reinstall-packages-from=<prev version>
    

Pyenv setup

  1. Install with brew install pyenv pyenv-virtualenv
  2. Install updated python3 version with pyenv install 3.10.2. It should show the following output:

    Installing Python-3.10.2...
    python-build: use readline from homebrew
    python-build: use zlib from xcode sdk
    Installed Python-3.10.2 to /Users/parag/.pyenv/versions/3.10.2
    
  3. Set up python3 globally with pyenv global 3.10.2.
  4. Install some commonly used packages with pip:

    pip install ansible 'python-lsp-server[all]' \
                requests 'ptvsd>=4.2' flake8 autoflake \
                importmagic epc
    

Rust setup

Taken from here.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

To uninstall, run rustup self uninstall

cargo install cargo-edit
cargo install cargo-audit
cargo install cargo-outdated
rustup component add rustfmt
rustup component add clippy

To learn Rust with Rustlings, install as follows:

curl -L https://git.io/install-rustlings | bash -s ~/Workspace/vendor/rustlings

Or you can also learn on Repl.it

Golang setup

  1. Install golang with brew install go.
  2. Set the go workspace with $GOPATH. This should already be set from the shell setup above. If not, then:

    export GOPATH=$HOME/Workspace/vendor/go
    

Other languages

  • Nim setup
    1. Install choosenim with curl https://nim-lang.org/choosenim/init.sh -sSf | sh
    2. Nim should be available in the "$HOME/.local/bin" path (see personal dotfiles for path settings).
    3. choosenim show
    4. nimble install nimlsp
  • C-C++ setup
    1. Ensure your emacs config is ready with correct C-C++ requirements.
    2. Install src code indexer RTags with brew install rtags.

Java setup

  1. Install java on Catalina with brew tap AdoptOpenJDK/openjdk && brew install --cask adoptopenjdk8.
  2. Verify with java -version.

Install Android Studio

  1. TODO: link to file

Emacs setup

  1. Install emacs:

    brew tap d12frosted/emacs-plus
    brew install emacs-plus
    brew linkapps emacs-plus
    # or ln -s /usr/local/Cellar/emacs-plus/26.3/Emacs.app/ /Applications
    
  2. Install spacemacs:

    git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
    
  3. Install Source Code font.
  4. Check out the develop branch: cd ~/.emacs.d && git checkout develop
  5. Symlink config files from your dotfiles: If using stow, then:

    dotfiles=path/to/dotfiles
    stow -d $dotfiles -vRt ~ emacs  # links spacemacs and other dot configs
    stow -d $dotfiles -vRt ~/.emacs.d/private emacsd-private-snippets # links snippets
    stow -d $dotfiles -vRt ~/.emacs.d/private/local emacsd-private-local # links everything in local
    

    If not using stow,

    ln -s $HOME/Workspace/play/dotfiles/.spacemacs $HOME/.spacemacs
    rm -rf $HOME/.emacs.d/private/snippets
    ln -s $HOME/Workspace/play/dotfiles/snippets $HOME/.emacs.d/private/snippets
    git checkout $HOME/.emacs.d/private/snippets/README.md
    
  6. Install iSpell for emacs with brew install ispell.
  7. Install ag with brew install ag (for searching in emacs).
  8. Install Pygments as a generic syntax highlighter.
  9. Install Poppler, a PDF-rendering library with brew install poppler.

    Or open emacs and run pdf-tools-install

  10. Install BasicTeX as the latex package with brew install --cask basictex.
    1. Make sure /Library/Tex/bin is in the $PATH. (With dotfiles, you should already have it so).
    2. Update tlmgr with sudo tlmgr update --self.
    3. Install additional latex packages with:

      tlmgr install wrapfig capt-of catchfile
      tlmgr install dvipng titling hyphenat titlesec enumitem
      tlmgr install chemfig simplekv mhchem
      tlmgr install minted fvextra xstring framed # for minted
      
  11. Start emacs from the Applications.
  12. Enable markdown in org-export-backends (with Customize).

Postgres setup

  1. Install postgresql with brew install postgresql.
  2. Start postgres (not as a background service) with pg_ctl -D /usr/local/var/postgres start.
  3. Install TablePlus app (paid) as the GUI utility for all DBs with brew install --cask tableplus.

Devops setup

  1. Install aws-cli with brew tap aws/tap && brew install awscli.
  2. Install AWS SAM: brew tap aws/tap && brew install aws-sam-cli.
  3. Install aws session-manager-plugin with brew install --cask session-manager-plugin. You might need to manually run it once since the program is not verified.
  4. Install Cloudman with brew install dutchcoders/cloudman/cloudman.
  5. Set up Hashicorp tap for their products with brew tap hashicorp/tap.
  6. Install Terraform with brew install hashicorp/tap/terraform terraform-docs.
  7. Install Nomad with brew install hashicorp/tap/nomad.
  8. Install Consul with brew install hashicorp/tap/consul.
  9. Install Packer with brew install hashicorp/tap/packer.
  10. Install Vault with brew install hashicorp/tap/vault.
  11. Install Waypoint with brew install hashicorp/tap/waypoint.
  12. Install Faas with brew install faas-cli.
  13. Install Docker desktop for mac.
  14. Install Podman with brew install podman.
  15. Install Virtualbox with brew install --cask virtualbox.
  16. Install Vagrant with brew install --cask vagrant.
  17. Install Gas Mask with brew install --cask gas-mask.
  18. Install Postman app with brew install --cask Postman.
  19. Install Parquet tools for AWS deser with brew install parquet-tools.
  20. Install Skopeo with brew install skopeo.
  21. Install Multipass with brew install --cask multipass.
  22. Install xxh with brew install xxh.
  23. Install dive with brew install dive.

X11 support setup

  • Install socat with brew install socat. It might be already installed.
  • Install xquartz with brew install xquartz.
  • Log out and log back in
  • Run socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"

Hardware and firmware setup

  1. Install Platformio with brew install platformio. More details on Platformio mode for emacs can be found here.
  2. Install cask drivers brew tap homebrew/cask-drivers
  3. Install USB to UART support brew install --cask silicon-labs-vcp-driver
  4. Install protobuf for protobuf message compilations: brew install protobuf

Dropbox setup

  1. Install Dropbox: brew install --cask dropbox.

Password manager setup

  1. Install password managers: brew install --cask keepassxc lastpass.
  2. If you installed keepassxc:
    1. open the app
    2. create a new password database (.kbdx) and save in Dropbox
    3. set a new master password
    4. go to the app settings
    5. click on "Enable browser integration" and choose Firefox
    6. install the Firefox addon here
    7. go the addon settings and enable http connection (last option in the settings menu)
    8. this opens an authentication dialog where you enter the same details as in the app to enable autofill in browsers

Install Sketch app

Follow this link to download the app.

Mail setup

  1. Open Mail app and set up your accounts.
  2. Install Thunderbird with brew install --cask thunderbird.
  3. If you use Protonmail, you'll need to add their Bridge app which sets up localhost as the IMAP and SMTP servers.

Music player setup

  1. Install Spotify app - brew install --cask spotify
  2. Install Spotify CLI - brew install shpotify.
  3. Log in to Spotify developer console and create an application.
  4. Note down the Client ID and Client Secret.
  5. Create a new file in $HOME/.shpotify.cfg and enter the following:

    CLIENT_ID="<client id from 3 above>"
    CLIENT_SECRET="<client secret from 3 above>"
    
  6. Open Spotify app and play a song.
  7. Run spotify next from the command line. Or other commands from the cli.
  8. Install Deezer with brew install --cask deezer.
  9. Install Audius with brew install --cask audius.

Graphics software setup

  • Install blender with brew install --cask blender.

Security setup

  1. Install Cryptomator for file encryption with brew install --cask cryptomator.
  2. Install Lulu as the firewall to block unknown outgoing connections, with brew install --cask lulu.
  3. Install Netiquette as a network tracker GUI utility: brew install --cask netiquette.
  4. Install Oversight as webcam and mic monitoring utility: brew install --cask oversight.
  5. Install Malwarebytes for malware detection with brew install --cask malwarebytes.

Wordpress and CMS setup

  1. Install Mamp with brew install --cask mamp.

Game development setup

  1. Install Unity package manager with npm install -g openupm-cli.
  2. Install Inkle Studio editor with brew install --cask inky.

    You can find the repo for developing Inkle games here.

Other useful utility packages:

  1. Install Glances with brew install glances. Run as glances.
  2. Install Dust - better du with brew install dust. Run as dust --reverse <folder>.
  3. Install Bottom with brew install bottom. Run with btm --help.
  4. Install video player VLC with brew install --cask vlc.
  5. Install wireshark-like tool for the terminal (depends on go): [UPDATE 2021-02-13] Uninstalled

    brew install termshark
    

    See details on running it here.

  6. Install a CI-Friendly tool for document a database, written in Go:

    brew install k1LoW/tap/tbls
    

    See details on running it here.

  7. Install MS Remote Desktop with brew install --cask microsoft-remote-desktop.
  8. Install Spectacle app as the window manager with brew install --cask spectacle.
  9. Install imageoptim-cli with brew install imageoptim-cli.
  10. [REMOVED] Install iina as the movie player with brew install --cask iina.
  11. (Optional) Install Zoom.us with brew install --cask zoomus.
  12. Install Android File Transfer via the DMG file.
  13. Install inkscape with brew install --cask inkscape.
  14. Install ADR Tools with brew install adr-tools.
  15. Install Disk Usage/Free Utility (duf) with brew tap muesli/tap && brew install duf.
  16. Install CSV query utility called q with brew install q.
  17. Install Graphviz with brew install graphviz.
  18. [REMOVED] Install All-in-one-messenger with brew install --cask all-in-one-messenger.
  19. Install Video editing software, Openshot with brew install --cask openshot-video-editor.
  20. Install Mailstudio app from their downloads page - https://mailstudio.app/
  21. Install ngrok with brew install --cask ngrok.
  22. Install Bore with cargo install bore-cli.
  23. Install livestreaming and screen recording tool OBS with brew install --cask obs.
  24. Install imazing with brew install --cask imazing.
  25. Install Dictionaries app with brew install --cask dictionaries.
  26. Install Slack Desktop app with brew install --cask slack.
  27. Install Alt Tab app with brew install alt-tab.
  28. Install Signal desktop app with brew install --cask signal.
  29. Install Telegram Desktop app with brew install --cask telegram-desktop-beta.