Fullstack Developer & Whitewater Kayaker & Scout
I have my MacBook Pro since 2020. After having used the MacBook Pro 2015 for a couple of years. The last months have been super productive and exiciting and I am up running working efficiently my personal and projects as fullstack engineer. Here I want to share with you my Mac setup for web development and I will try to update ii all the time.
sudo scutil --set ComputerName "newname"
sudo scutil --set LocalHostName "newname"
sudo scutil --set HostName "newname"
Override more system preferences from the terminal ...
# take screenshots as jpg (usually smaller size) and not png
defaults write com.apple.screencapture type jpg
# do not open previous previewed files (e.g. PDFs) when opening a new one
defaults write com.apple.Preview ApplePersistenceIgnoreState YES
# show Library folder
chflags nohidden ~/Library
# show hidden files
defaults write com.apple.finder AppleShowAllFiles YES
# show path bar
defaults write com.apple.finder ShowPathbar -bool true
# show status bar
defaults write com.apple.finder ShowStatusBar -bool true
killall Finder;
If files from previous machine are needed, transfer via external drive instead of cloud
Install Homebrew as package manager for macOS:
# paste in terminal and follow the instructions
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Update everything in Homebrew to recent version:
brew update
Install GUI applications (read more about these in GUI Applications):
brew install --cask \
1password \
google-chrome \
firefox \
brave-browser \
iterm2 \
visual-studio-code \
sublime-text \
docker \
slack \
vlc \
figma \
maccy \
gpgtools \
raycast \
karabiner-elements \
meld \
spotify \
postman \
numi \
dbgate \
f.lux
Install terminal applications (read more about these in Terminal Applications):
brew install \
wget \
git \
node \
nvm \
yarn \
pnpm \
mc \
tig \
gnupg \
thefuck \
htop \
coreutils \
jq
Google Chrome (web development, web browsing)
Preferences
Chrome Extensions
Firefox (web development)
Brave (web browsing, wallet)
iterm2 (terminal)
Visual Studio Code (web development IDE)
Sublime Text (editor)
Slack (team messenger)
VLC (video player)
Figma (design)
Maccy (clipboard manager)
Add Space to Dock
The look and feel we want to achieve from our Dock:
# https://www.facebook.com/SUPERKODERS/posts/pfbid031VxSTroikATWz4yKTC2tZ3ggDQj8XpTiLxCL3cmXqMKTc6Cw2PGv7bsUggML23cml
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
Using instead of build-in applications.
https://github.com/literat/dotfiles
The look and feel we want to achieve from our terminal:
When you open iTerm2, you see that MacOS already comes with zsh as default shell. Install Oh My Zsh for an improved (plugins, themes, ...) terminal (here: iTerm2) experience:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Update everything (e.g. plugins) in Oh My Zsh to recent version:
omz update
Important: If you change something in your Zsh configuration (.zshrc), force a reload:
source ~/.zshrc
Install Agnoster as your new terminal theme. We will use Homebrew, but you can use an alternative from the website too:
brew install agnoster
Make it the default theme for Oh My ZSH from the terminal:
echo 'eval "$(agnoster init zsh)"' >> ~/.zshrc
Install powerline fonts. As font we will be using Hack Nerd Font in iTerm2, VS Code, and Sublime Text. Install it via:
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
Use the new font in iTerm2: Preferences -> Profile -> Text -> Font: font-hack-nerd-font.
If the theme and font changes do not apply, reload your zsh configuration (.zshrc) or close/open iTerm2.
Install and configure powerleven10k
p10k configure
Install and configure Znap
Oh My Zsh Plugins
ZSH Configuration File (.zshrc)
The look and feel we want to achieve from our IDE:
Activate settings sync with VSCode Setting Gist
From terminal, set global name and email:
git config --global user.name "Your Name"
git config --global user.email "you@your-domain.com"
Improved git log:
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
Now use:
git lg
Set the default branch to main instead of master:
git config --global init.defaultBranch main
Print global git configuration:
git config --list
# or alias
# gitconfig
Setup GPG commit verification
# https://gist.github.com/oseme-techguy/bae2e309c084d93b75a9b25f49718f85
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# Also correct the permissions and access rights on the directory
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
# Originaly: https://stackoverflow.com/questions/39494631/gpg-failed-to-sign-the-data-fatal-failed-to-write-commit-object-git-2-10-0
brew upgrade gnupg # This has a make step which takes a while
brew link --overwrite gnupg
brew install pinentry-mac
echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
killall gpg-agent
echo "test" | gpg --clearsign # on linux it's gpg2 but brew stays as gpg
git config --global gpg.program gpg # perhaps you had this already? On linux maybe gpg2
git config --global commit.gpgsign true # if you want to sign every commit
git commit -S -m ""
git log --show-signature -1
Export public GPG key
gpg --output public.pgp --armor --export username@email
There are two common strategies for SSH keys: one SSH key to rule them all or one SSH key per service. I use the latter one and will here run yout through it by connecting to GitHub via SSH.
First, create a new SSH key in the ~/.ssh folder:
mkdir ~/.ssh
cd ~/.ssh
# or alias
# sshhome
ssh-keygen -t ed25519 -C "github"
# follow instructions
# use file name: github
# use passphrase and store it somewhere secure
Confirm whether passphrase was used properly by accessing private key:
ssh-keygen -y -f gitHub
# confirm with passphrase
Create the SSH configuration file if it doesn't exist yet:
# in case the file is not there yet
touch ~/.ssh/config
In your ~/.ssh/config file, add the new SSH key, so that it can get picked up for every terminal session automatically:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/github
Add SSH key to MacOS' keychain:
ssh-add --apple-use-keychain ~/.ssh/github
Add the public key to your GitHub settings via the website or via the GitHub CLI (via brew install gh):
# copy public key and add it to https://github.com/
cat ~/.ssh/id_rsa.pub | pbcopy
# or use GitHub's CLI
gh auth login
# for the first login I think the SSH key gets added
gh ssh-key add ~/.ssh/id_rsa.pub -t github
That's it. You have created an SSH key locally for one specific service, secured it via a passphrase, made it automatically available for every terminal session, and applied it to GitHub. In the case of GitHub, you are now able to interact with GitHub via SSH.
The node version manager (NVM) is used to install and manage multiple Node versions. After you have installed it via Homebrew in a previous step, type the following commands to complete the installation:
echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.zshrc
source ~/.zshrc
# or alias
# zshsource
Now install the latest LTS version on the command line:
nvm install <latest LTS version from https://nodejs.org/en/>
Afterward, check whether the installation was successful and whether the node package manager (npm) got installed along the way:
node -v && npm -v
Update npm to its latest version:
npm install -g npm@latest
And set defaults for npm:
npm set init.author.name "your name"
npm set init.author.email "you@example.com"
npm set init.author.url "example.com"
If you are a library author, log in to npm too:
npm adduser
That's it. If you want to list all your Node.js installation, type the following:
nvm list
If you want to install a newer Node.js version, then type:
nvm install <version> --reinstall-packages-from=$(nvm current)
nvm use <version>
nvm alias default <version>
Optionally install yarn if you use it as alternative to npm:
npm install -g yarn
yarn -v
If you want to list all globally installed packages, run this command:
npm list -g --depth=0
That's it. You have a running version of Node.js and its package manager.
I hope my setup helps other developers to get their Mac up and running. If you have any additional ideas or want to share your setup, let me know!