Skip to content

Instantly share code, notes, and snippets.

@techieimposter
Forked from coreygo/macos-info.md
Created May 12, 2019 09:34
Show Gist options
  • Save techieimposter/4c0a55e8e2917c99ed816403815d65f6 to your computer and use it in GitHub Desktop.
Save techieimposter/4c0a55e8e2917c99ed816403815d65f6 to your computer and use it in GitHub Desktop.

Helpful Information for MacOS

The below information is current as of 2019-05-11 and applies to MacOS 10.14.x (Mojave).

This document is meant to serve as an aid and reference in preparing a MacOS system, the process and .dotfiles are completed manually. Note that the default Terminal is replaced with iTerm2 and Bash v5.

For additional information or help please feel free to ping via https://www.coreygo.com.

System information commands

  • uptime displays current system uptime
  • system_profiler SPHardwareDataType displays hardware overview
  • system_profiler -listDataTypes lists available system_profiler options
  • system_profiler -detailLevel basic > ~/system_profile.txt outputs to text document for sharing

Security

Review the macOS Security and Privacy Guide and Stronghold.

  • Set root password
    • sudo passwd -u root
  • For Development (disable macOS Gatekeeper)
    • sudo spctl --master-disable

Software updates

  • softwareupdate -l
  • sudo softwareupdate -iaR --verbose

System

  • Set login screen message
    • sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "coreygo.com"
  • Disable screenshot drop shadow
    • defaults write com.apple.screencapture disable-shadow -bool true && killall SystemUIServer
  • Hide Desktop
    • defaults write com.apple.finder CreateDesktop false && killall Finder
  • Show All Files
    • defaults write com.apple.finder AppleShowAllFiles YES
    • CMD+SHIFT+.

Networking

Set computer name (System Preferences → Sharing)

sudo scutil --set ComputerName "entropy"
sudo scutil --set HostName "entropy"
sudo scutil --set LocalHostName "entropy"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName $(scutil --get LocalHostName)

Disable .DS_Store on network shares

  • defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Speed up SMB client to Synology NAS by disabling packet signing

https://support.apple.com/en-us/HT205926

sudo -s
echo "[default]" >> /etc/nsmb.conf
echo "signing_required=no" >> /etc/nsmb.conf
exit

Software

Homebrew

  • Xcode Command Line Tools

    • xcode-select --install
  • Homebrew

    • /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    • brew config
  • Homebrew Cask

    • brew tap caskroom/cask
    • brew tap caskroom/versions
    • brew tap caskroom/drivers
    • brew tap caskroom/fonts
    • brew tap homebrew/services
    • brew tap buo/cask-upgrade (brew cu)
    • brew install vitorgalvao/tiny-scripts/cask-repair (cask-repair)
  • Homebrew FAQ (man page)

    • brew update-reset && brew update
    • brew upgrade && brew cu
    • brew cleanup -s
    • rm -rf $(brew --cache)
    • brew missing and brew doctor and brew config
    • brew uninstall {{package name}} to uninstall a Homebrew package
    • brew cask uninstall {{cask name}} to uninstall a Homebrew cask package
    • brew untap {{cask name}} to untap a Homebrew cask

    Post Install

    cat << 'EOF' >> ~/.secrets
    # Set Homebrew's GitHub access token
    export HOMEBREW_GITHUB_API_TOKEN=
    EOF

    Additional Post Install

    cat << 'EOF' >> ~/.bash_profile
    # Export Homebrew environment variables
    export HOMEBREW_FORCE_VENDOR_RUBY=1
    export HOMEBREW_FORCE_BREWED_GIT=1
    export HOMEBREW_FORCE_BREWED_CURL=1
    
    # Set alias bup to update Homebrew
    alias bup="brew update-reset && brew update && brew upgrade && brew cu && brew cleanup -s && rm -rf $(brew --cache) && brew missing && brew config && brew doctor"
    EOF
  • Search for Formulae

    • brew search google (includes formulae and casks)
  • Search for Casks

Fonts

  • Search installed fonts: system_profiler SPFontsDataType | grep Fura

  • Search Homebrew fonts: brew search /roboto/

  • Install (via brew or source): Fira Code, Hack, Nerd Fonts, Source Code Pro, Roboto, additional "cloud" fonts can be installed via the Adobe Creative Cloud app.

    • brew cask install font-roboto
    • brew cask install font-firacode-nerd-font
    • brew cask install font-fira-code
    • brew cask install font-meslo-nerd-font
    • brew cask install font-sourcecodepro-nerd-font
    • brew cask install font-source-code-pro

Terminal

  • Create empty ~/.bash_profile if needed (shouldn't be if steps above were used)

    • if [ ! -f ~/.bash_profile ]; then touch ~/.bash_profile; fi;
  • Create ~/.bashrc if needed and source ~/.bash_profile

    • if [ ! -f ~/.bashrc ]; then echo '[ -n "$PS1" ] && source ~/.bash_profile;' >> ~/.bashrc; fi;
  • iTerm2

    • brew cask install iterm2-beta
      or — brew cask install iterm2

    Post Install

    • Run iTerm2 then make it the default Terminal
    • Install iTerm2 shell integration and utilities and update ~/.bash_profile with tmux export
    curl -L https://iterm2.com/shell_integration/install_shell_integration_and_utilities.sh | bash
    
    cat << 'EOF' >> ~/.bash_profile
    # Enable iTerm2 Shell Integrations
    export ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX=1
    test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
    EOF
    • Change default profile: 160x48, Solarized Dark, FuraCode Nerd Font 14pt Regular (use ligatures, anti-aliased), Terminal.app compatibility
    • Additional key mapping changes may be required for natural editing (like keyboard shortcuts for cursor movement in Terminal and vim)
    ⌥← # Send escape sequence b
    ⌥→ # Send escape sequence f
    ⌘←Delete # Send hex code 0x15
    ⌥←Delete # Send hex code 0x1b 0x7f
    Del→ # Send hex code 0x4-
    ⌥Del→ # Send escape sequence d

Bash and Command Line Binaries

  • Bash v5

    • brew install bash

    Post Install

    # Switch to using brew-installed bash as default shell
    if ! fgrep -q '/usr/local/bin/bash' /etc/shells; then
      echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;
      chsh -s /usr/local/bin/bash;
    fi;
    • echo $BASH_VERSION
  • Set default language and source imports

    cat << 'EOF' >> ~/.bash_profile
    # Set Language
    export LANG="en_US.UTF-8"
    export LC_ALL="$LANG"
    
    # Imports
    test -e "${HOME}/.secrets" && source "${HOME}/.secrets"
    EOF
  • Set default editors

    cat << 'EOF' >> ~/.bash_profile
    # Set default editors
    export EDITOR="$(which vim)"
    export VISUAL="$EDITOR"
    # Set editors for Git and Homebrew
    export GIT_EDITOR="$EDITOR"
    export HOMEBREW_EDITOR="$EDITOR"
    EOF
  • Bash Completion

    • brew install bash-completion@2

    Post Install

    cat << 'EOF' >> ~/.bash_profile
    # Enable bash tab completion
    export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d"
    [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
    EOF

Command Line Binaries

Replace and augment MacOS default binaries

  • brew install vim --with-override-system-vi --with-python3

  • brew install coreutils

    Post Install coreutils (optional, will cause warning from brew doctor)

    All commands have been installed with the prefix 'g'.
    
    If you really need to use these commands with their normal names:
    
    cat << 'EOF' >> ~/.bash_profile
    # Set local opt coreutils bin $PATH
    export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
    EOF
  • brew install curl

    Post Install curl

    cat << 'EOF' >> ~/.bash_profile
    # Set local opt curl bin $PATH
    export PATH="/usr/local/opt/curl/bin:$PATH"
    EOF
  • brew install diffutils

  • brew install findutils
    or — brew install findutils --with-default-names
    (optional, will cause warning from brew doctor)

  • brew install gawk

  • brew install gnu-sed --with-default-names

  • brew install gnu-tar --with-default-names

  • brew install gnu-which --with-default-names

  • brew install gnutls

  • brew install grep --with-default-names

  • brew install gzip

  • brew install htop

  • brew install openssh --with-ldns

  • brew install rsync

  • brew install screen

  • brew install tmux

  • brew install tree

  • brew install watch

  • brew install wdiff

  • brew install wget

    Post Install command line binaries

    cat << 'EOF' >> ~/.bash_profile
    # Set local system bin $PATH
    export PATH="$PATH:/usr/local/sbin"
    EOF

Additional command line binaries

  • brew install nmapnmap — network mapper

  • brew install youtube-dlyoutube-dl

  • brew install emacsemacs

  • brew install pandocpandoc

  • brew install basictexbasictex

    Post Install pandoc and basictex

    sudo tlmgr update --self
    sudo tlmgr install collection-fontsrecommended

Additional command line binaries, dependencies, and packages

Git

  • brew install git

  • brew install git-lfs && git lfs install

    Post Install

    git config --global user.name "Corey Gouker"
    git config --global user.email corey@coreygo.com
    git config --global user.signingkey F8189720240A11D1
    git config --global github.user coreygo
    git config --global core.editor vim
    git config --global color.ui auto
    git config --global commit.gpgsign true
    git config --global credential.helper osxkeychain

    Additional Post Install

    cat << 'EOF' >> ~/.secrets
    # Set GitHub's hub user and access token
    # https://github.com/settings/tokens
    export GITHUB_USER=coreygo
    export GITHUB_TOKEN=
    EOF

Applications

Google

Web, Security, Communications

  • Firefox Developer Edition
    • brew cask install firefox-developer-edition or/and for side by side installation — brew cask install firefox
  • ProtonVPN
    • brew cask install protonvpn
  • Tor Browser
    • brew cask install tor-browser
  • OnionShare
    • brew cask install onionshare
  • Magic-Wormhole
    • brew install magic-wormhole
  • Bitwarden
    • brew cask install bitwarden
  • 1Password
    • brew cask install 1password-beta or for non-beta version — brew cask install 1password
  • GPG Suite
    • brew cask install gpg-suite
  • Irssi
    • brew install irssi
  • Mosh
    • brew install mosh
  • Tunnelblick
    • brew cask install tunnelblick
  • Slack
    • brew cask install slack
  • Discord
    • brew cask install discord
  • Signal
    • brew cask install signal
  • Keybase
    (requires KEXT - System Preferences → Security & Privacy → General)
    • brew cask install keybase

Development

  • Visual Studio Code

    • brew cask install visual-studio-code-insiders
      or for non-Insiders build — brew cask install visual-studio-code

    Post Install Visual Studio Code — Insiders (extensions list and settings information)

    • To reinstall all extensions from a terminal
      curl -fsSL https://git.io/fh6Lz | bash
  • JetBrains Toolbox

    • brew cask install jetbrains-toolbox
  • Eclipse IDE

    • brew cask install eclipse-installer
  • Postman

    • brew cask install postman
  • VirtualBox
    (requires KEXT - System Preferences → Security & Privacy → General)

    • brew cask install virtualbox
    • brew cask install virtualbox-extension-pack
  • Docker

    Post Install (using stable or edge Docker Desktop for Mac)

    etc=/Applications/Docker.app/Contents/Resources/etc
    ln -s $etc/docker.bash-completion $(brew --prefix)/etc/bash_completion.d/docker
    ln -s $etc/docker-machine.bash-completion $(brew --prefix)/etc/bash_completion.d/docker-machine
    ln -s $etc/docker-compose.bash-completion $(brew --prefix)/etc/bash_completion.d/docker-compose
    • or if not using the "Docker Desktop for Mac" app (VirtualBox based install, not using the HyperKit hypervisor) consider installation using the non-cask formulae, details for this option have not been provided or tested
  • Kubernetes — (k8s docs)

    Post Install (via edge release of Docker Desktop for Mac)

    • Docker → Preferences → Kubernetes → check all three boxes to enable → Apply
    • For kubectl bash completion kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl
  • Helm

    • brew install kubernetes-helm
  • Vagrant

    • brew cask install vagrant
  • Packer

    • brew install packer
  • Terraform

    • brew install terraform
  • Zeit Now

    • brew cask install now
  • dnsmasq

    • brew install dnsmasq

    Post Install

    # Backup example dnsmasq.conf
    cp $(brew --prefix)/etc/dnsmasq.conf $(brew --prefix)/etc/dnsmasq.conf.example
    # Create and enable dnsmasq.d configuration directory
    mkdir -p $(brew --prefix)/etc/dnsmasq.d
    echo -e "\n# Include all files in a directory which end in .conf\nconf-dir=/usr/local/etc/dnsmasq.d/,-.conf" >> $(brew --prefix)/etc/dnsmasq.conf
    # Create and enable configuration(s)
    echo -e "address=/.lo/fdff::1\naddress=/.lo/10.254.254.254" >> $(brew --prefix)/etc/dnsmasq.d/lo.conf
    echo -e "address=/local.coreygo.dev/fdff::1\naddress=/local.coreygo.dev/10.254.254.254" >> $(brew --prefix)/etc/dnsmasq.d/local.coreygo.dev.conf
    # Start dnsmasq with launchd now and restart at startup
    sudo brew services start dnsmasq
    # Create and enable DNS resolver(s) for dnsmasq
    sudo mkdir -p /etc/resolver
    sudo bash -c 'echo -e "nameserver ::1\nnameserver 127.0.0.1" >> /etc/resolver/lo'
    sudo bash -c 'echo -e "nameserver ::1\nnameserver 127.0.0.1" >> /etc/resolver/local.coreygo.dev'
    • Create persistent lo0 alias
    cat << 'EOF' | sudo tee -a /Library/LaunchDaemons/com.coreygo.lo0.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.coreygo.lo0</string>
        <key>RunAtLoad</key>
        <true/>
        <key>ProgramArguments</key>
        <array>
          <string>bash</string>
          <string>-c</string>
          <string>/sbin/ifconfig lo0 alias 10.254.254.254 &amp;&amp; /sbin/ifconfig lo0 inet6 alias fdff::1</string>
        </array>
    </dict>
    </plist>
    EOF
    • Enable the launchd service to activate persistent lo0 alias
      sudo launchctl load /Library/LaunchDaemons/com.coreygo.lo0.plist

System, Utilities, Other Applications

  • Mac App Store CLI
    • brew install mas
  • Microsoft OneNote
    • mas install 784801555 (AppID for com.microsoft.onenote.mac)
  • Transmission Remote GUI
    • brew cask install transmission-remote-gui
  • Keka
    • brew cask install keka
  • CyberDuck
    • brew cask install cyberduck
  • Radio Silence
    • brew cask install radio-silence
  • OverSight
    (requires KEXT - System Preferences → Security & Privacy → General)
    • brew cask install oversight

    Workaround for installer hang

    • Open GUI and activate run in 'headless' mode
  • LuLu
    • brew cask install lulu
  • ClamAV
    • brew install clamav

    Review the (somewhat accurate) MacOS installation guide and FAQ for additional details before starting the process

    • For latest definitions
      freshclam -v
    • For an on-demand directory/file scan
      clamscan -r -i --bell ~/
    • For an on-demand "complete" scan
      clamscan -r -i --bell --cross-fs=no --detect-pua=yes /

Media Streaming and Production

Audio/Video Playback and Management

  • VLC
    • brew cask install vlc
  • Plexamp
    • brew cask install plexamp
  • MusicBrainz Picard
    • brew cask install musicbrainz-picard

    Post Install

    • brew install flac mp3gain
    • MusicBrainz Picard Preferences → Plugins → Install ReplayGain → Enable → Make It So
    • Path to metaflac /usr/local/bin/metaflac
    • Path to mp3gain /usr/local/bin/mp3gain

eBook Management

Adobe

  • Adobe Creative Cloud
    • brew cask install adobe-creative-cloud

    Post Install

    • open '/usr/local/Caskroom/adobe-creative-cloud/latest/Creative Cloud Installer.app'

Gaming

  • Steam
    • brew cask install steam
  • OpenEMU
    • brew cask install openemu

Evernote

Conferencing and Remote Computing

Programming Environments

NodeJS & TypeScript

  • Node Version Manager

    • curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

    Post Install

    • Update ~/.bash_profile (also undo any changes to .bashrc)
    cat << 'EOF' >> ~/.bash_profile
    # Enable Node Version Manager
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
    EOF
    • source ~/.bash_profile or restart terminal session

    NVM Manual Upgrade

    (
      cd "$NVM_DIR"
      git fetch --tags origin
      git checkout `git describe --abbrev=0 --tags --match "v[0-9]-" $(git rev-list --tags --max-count=1)`
    ) && \. "$NVM_DIR/nvm.sh"
  • NodeJS — via NVM

    • nvm install lts/- for latest LTS Node or for a specific version nvm install v10.15.3
    • nvm install lts/- --reinstall-packages-from=node install latest LTS Node and reinstall packages from current Node
    • nvm version-remote lts/- display latest available LTS Node version
    • nvm ls-remote --lts list latest available LTS Node versions
    • nvm install node --reinstall-packages-from=node install latest non-LTS Node and reinstall packages from current Node

    Global NodeJS Packages

    • npm i -g npm npm-check npm-check-updates eslint standard typescript tslint prettier terser
    • npm ls -g --depth=0 display top level global packages
    • npm-check -gu check for and/or install latest global packages

    Additional Global NodeJS Packages

    • npm i -g create-react-app gatsby-cli netlify-cli

    Yarn Package Manager

    • brew install yarn note, will currently brew install node as a dependency

Python

  • Python — review additional details prior to installing Python via Homebrew to avoid potential issues.

    • brew install python and/or for Python 2 brew install python@2

    Post Install

    • Update ~/.bash_profile
    cat << 'EOF' >> ~/.bash_profile
    # Set Python 3 $PATH
    export PATH="/usr/local/opt/python/libexec/bin:$PATH"
    EOF
  • pipenv

    • brew install pipenv

    Post Install for pipenv

    cat << 'EOF' >> ~/.bash_profile
    # Set Python 3 pipenv to create .venv in project path  
    export PIPENV_VENV_IN_PROJECT=true
    EOF
    • mkdir -p {{project name}} && cd "$_" to create a new Python project directory and pipenv install to create a new pipfile and virtualenv then pipenv shell to activate the virtualenv, you are now ready to pip3 install {{package name}} (use pip3 to avoid issues), and remember to deactivate the shell with exit
    • See pipenv --help or go here for advanced usage details
    • If Python 2 is required for pipenv and virtualenv usage brew install python@2, for a Python 2 project pipenv install --two, remember to review the Python via Homebrew link above before installing Python 2

Ruby

  • Ruby — via rbenv, also review here for Rails and additional information

    • brew install rbenv

    Post Install

    • rbenv init
    • Update ~/.bash_profile
    cat << 'EOF' >> ~/.bash_profile
    # Enable rbenv Ruby environment manager
    if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi # This loads rbenv
    EOF
    • source ~/.bash_profile or restart terminal session
    • rbenv --version
    • curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
    • rbenv install 2.6.3 or to list available versions rbenv install -l
    • rbenv global 2.6.3 or to get current active version rbenv global
    • ruby -v
    • gem env for RubyGems environment details
    • gem env home check the location where gems are being installed
    • gem outdated and gem update --force
    • gem cleanup
    • gem install bundler

Go

  • Go

    • brew install go

    Post Install

    cat << 'EOF' >> ~/.bash_profile
    # Go Language
    export PATH="$PATH:/usr/local/opt/go/libexec/bin"
    EOF
    • source ~/.bash_profile or restart terminal session
    • brew install dep
    • brew install gox

Java

Processing

SDKs & CLIs

  • Google Cloud SDK

    • brew cask install google-cloud-sdk

    Post Install

    cat << 'EOF' >> ~/.bash_profile
    # Enable Google Cloud SDK
    test -e "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc" && source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"
    test -e "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc" && source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc"
    EOF
  • AWS CLI & Python SDK — first follow steps above to install Python 3 including pipenv via Homebrew

    • cd ~ && mkdir -p .aws && cd "$_" && pipenv install awscli boto3 && pipenv run aws --version
    • cd ~/.aws && pipenv run aws --version to confirm the AWS CLI version, for help see pipenv run aws help
    • or run a command like aws configure after activating the shell cd ~/.aws && pipenv shell remember to exit
  • Azure CLI

    • brew install azure-cli
    • az login
    • az help

Hardware

Wacom Intuos Tablet

  • brew cask install wacom-tablet

OpenBCI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment