macOS - RLovelett/dotfiles Wiki

macOS Mojave

  1. sudo without password
  2. GPG
  3. ZSH
  4. Antigen
  5. Fonts
  6. iTerm2

1. sudo without password

## Allow rlovelett to run ALL commands without a password
$ echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo EDITOR='tee -a' visudo

2. GnuPG - GNU Privacy Guard

$ brew install gnupg pinentry-mac
$ vi ~/.gnupg/gpg-agent.conf
pinentry-program /usr/local/bin/pinentry-mac
enable-ssh-support
cat << EOF > $HOME/Library/LaunchAgents/sh.brew.gnupg.gpg-agent.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>
	<!-- man launchd -->
	<!-- Set the name of the Launchd task -->
	<key>Label</key>
	<string>sh.brew.gnupg.gpg-agent</string>
	<!-- Set a command to run and its arguments -->
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/bin/gpgconf</string>
		<string>--launch</string>
		<string>gpg-agent</string>
	</array>
	<!-- Tells the task to run once the XML is loaded -->
	<key>RunAtLoad</key>
	<true />
	<!-- <key>Sockets</key>
	<dict>
		<key>Listeners</key>
		<dict>
			<key>SecureSocketWithKey</key>
			<string>SSH_AUTH_SOCK</string>
		</dict>
	</dict>
	<key>EnableTransactions</key>
	<true/> -->
</dict>
</plist>
EOF
launchctl load -F $HOME/Library/LaunchAgents/sh.brew.gnupg.gpg-agent.plist
launchctl list | grep gpg-agent
cat << EOF > $HOME/Library/LaunchAgents/sh.brew.gnupg.link-ssh-auth-socket.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>
	<!-- man launchd -->
	<!-- Set the name of the Launchd task -->
	<key>Label</key>
	<string>sh.brew.gnupg.link-ssh-auth-sock</string>
	<!-- Set a command to run and its arguments -->
	<key>ProgramArguments</key>
	<array>
		<string>/bin/sh</string>
		<string>-c</string>
		<string>/bin/ln -sf $HOME/.gnupg/S.gpg-agent.ssh $SSH_AUTH_SOCK</string>
	</array>
	<!-- Tells the task to run once the XML is loaded -->
	<key>RunAtLoad</key>
	<true />
</dict>
</plist>
EOF
launchctl load -F $HOME/Library/LaunchAgents/sh.brew.gnupg.link-ssh-auth-socket.plist
launchctl list | grep link-ssh-auth-sock

2. ZSH

$ chsh -s /bin/zsh

3. Antigen

$ cd $HOME
$ git clone https://github.com/zsh-users/antigen.git .antigen

4. Fonts

$ git clone --depth 1 --branch master https://github.com/powerline/fonts.git $HOME/Source/powerline
$ $HOME/Source/powerline/install.sh

$ git clone --depth 1 --branch release https://github.com/adobe-fonts/source-sans-pro.git $HOME/Source/source-sans-pro
$ cp $HOME/Source/source-sans-pro/TTF/*.ttf $HOME/Library/Fonts

$ git clone --depth 1 --branch release https://github.com/adobe-fonts/source-code-pro.git $HOME/Source/source-code-pro
$ cp $HOME/Source/source-code-pro/TTF/*.ttf $HOME/Library/Fonts

Alternative

brew tap homebrew/cask-fonts
brew cask install font-meslo-lg-nerd-font
brew cask install font-sauce-code-pro-nerd-font

5. iTerm 2

As of iTerm2 3.3 (and later). Look in Preferences (⌘+,) → General (tab) → Preferences (sub-tab). At the bottom of the panel, there is a setting Load preferences from a custom folder or URL:.

https://stackoverflow.com/a/23356086/247730

6. SSH Reuse Connections

Speed Up SSH by Reusing Connections

Host 192.168.*
  ForwardAgent yes
  ControlMaster auto
  ControlPath ~/.ssh/sockets/%[email protected]%h-%p
  ControlPersist 600
mkdir -p $HOME/.ssh/sockets
chmod 0750 $HOME/.ssh/sockets
⚠️ **GitHub.com Fallback** ⚠️