Mac Setup Guide
This guide covers the basics of setting up a development environment on a new Mac. Whether you are an experienced programmer or not, this guide is intended for everyone to use as a reference for setting up your environment or installing languages/libraries.
These settings are all optional, consider them suggestions. Again this is my configuration, and you should always choose the setting that makes the most sense to you.
Last update: macOS Ventura (Aug 7, 2023)
macOS Update
System Settings > General > Software Update
The first thing you should do is update your macOS to the latest version to have a more secure OS as well keep your machine up to date.
System Preferences
If this is a new computer there are a couple tweaks you could make to the System Preferences.
Firewall
System settings > Network
- Activate the Firewall
FileVault
System settings > Privacy and Security
- Turn on FileVault
Appearence
System settings > Appearence
- Sidebar Icon Size →
Small
Displays
System settings > Displays
- Add more space
Trackpad
System settings > Trackpad
- Point & Click
- Enable ”Tap to click with one finger”
- Change “Look up & data detectors” to ”Tap with Three Fingers”
Internet Accounts
Add internet accounts
Dock
System settings > Desktop & Dock
- Make the size of icons Small
- Activate “Automatically hide and show de Dock”
- Disable “Animate opening applications”
- Disable “Show recent applications in Dock”
- Automatically hide and show the menu bar →
Desktop only
Control center
System settings > Control Center
- Add the ”Bluetooth” and “Sound” icons to “Always show in Menu Bar”
- Change ”Battery” to ”Show percentage”
Spotlight
System settings > Keyboard > Spotlight
- Uncheck the ”Show spotlight search” shortcut as we'll be replacing them with Raycast
Internet Accounts
System settings > Internet Accounts
- Add an iCloud account and sync Calendar, Find my Mac, Contacts etc.
Finder
Finder > Settings
- General
- Change ”New finder window show” to open in your Home Directory
- Sidebar
- Add Home and your Code Directory
- Advanced
- Enable “Show all filename extensions”
- “Keep folders on top”
- Enable “In windows when sorting by name”
- Enable “On Desktop”
Software Apps
- Music - Spotify
- Password - 1Password
- Storage - Google Drive
- Terminal - Warp
- Container - Docker
- Launcher - Raycast
- Mail - Microsoft Outlook
- Browser - Arc
- Brightness - Lunar
Development Environment
Command Line Tools for Xcode
Before you can run Homebrew you need to have the Command Line Tools for Xcode installed. It include compilers and other tools that will allow you to build things from source, and if you are missing this it's available through the App Store > Updates. You can also install it from the terminal by running the following:
sudo xcode-select --install
Homebrew
Homebrew calls itself The missing package manager for macOS and is an essential tool for any developer. To install Homebrew run the following in a terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then, to be able to use
brew
you need to start a new terminal session. After that you should make sure everything is working by running:brew doctor
If everything is good, you should see no warnings, and a message that you are "ready to brew!".
zsh
The Z shell (also known as
zsh
) is a Unix shell that is built on top of bash
(the default shell for macOS) with additional features. It's recommended to use zsh
over bash
. It's also highly recommended to install a framework with zsh
as it makes dealing with configuration, plugins and themes a lot nicer.Install
zsh
using Homebrew:brew install zsh
Now you should install a framework, we recommend to use Oh My Zsh or Prezto. Note that you should pick one of them, not use both.
The configuration file for
zsh
is called .zshrc
and lives in your home folder (~/.zshrc
).Creating a env.sh (optional)
We can include an
env.sh
file to store our aliases, exports, path changes etc. in order to not pollute our main configuration file too much. This file is found in the bottom of this page.Oh My Zsh
Oh My Zsh is an open source, community-driven framework for managing your
zsh
configuration. It comes with a bunch of features out of the box and improves your terminal experience.Install Oh My Zsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
The installation script should set
zsh
to your default shell, but if it doesn't you can do it manually:chsh -s $(which zsh)
Git
What's a developer without Git? To install, run:
brew install git
When done, to test that it installed properly you can run:
git --version
And
which git
should output /usr/local/bin/git
.Global .gitignote
First, create a
.gitignore
file for your global rules. Most people keep this in their home directory.touch ~/.gitignore
Next, open it with your text editor of choice and add whatever files and folders you always want to ignore.
Check my config file for
.gitignore
Finally, configure
git
to use our newly created ~/.gitignore
file.git config --global core.excludesfile ~/.gitignore
Configure global options
First, we'll define your Git user:
git config --global user.name "Your Name Here" git config --global user.email "your_email@youremail.com" # Alias git config --global alias.cm 'commit -m' git config --global alias.ls 'log --oneline' git config --global alias.st 'status -sb' git config --global alias.cp cherry-pick git config --global alias.f fetch git config --global alias.pl pull git config --global alias.save '!git add -A && git commit -m' git config --global alias.ps push git config --global alias.co checkout git config --global alias.cob 'checkout -b' git config --global alias.ll '!git branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate'
They will get added to your
.gitconfig
file.Next, let’s add the autoSetupRemote option:
git config --global --add --bool push.autoSetupRemote true
Configure case sensitiveness:
git config --global core.ignorecase false
Configure SSH access to Github
GitLab uses the SSH protocol to securely communicate with Git. When you use SSH keys to authenticate to the GitLab remote server, you don't need to supply your username and password each time.
- 1. Create SSH keys in your computer
Go to the terminal and enter the following
ssh-keygen -b 4096 -t rsa
You will be prompted to enter a filename. By default, your keys will be saved as
id_rsa
and id_rsa.pub
. - 2. Add the SSH key to your Github account
Copy the contents of your public key file:
pbcopy < ~/.ssh/id_rsa.pub
Navigate to the Github SSH keys configuration page and add the SSH you just copied. You may use the name that you prefer as the identifier for the key.
Node
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. The easiest way to handle node installations is using the Node Version Manager (nvm).
Download and install nvm via Homebrew:
brew install nvm
After that, we need to edit .zshrc (
vim ~/.zshrc
) and add the below given lines at the end:export NVM_DIR=~/.nvm source $(brew --prefix nvm)/nvm.sh
Check my config file for
zsh
Then download Node and select your version by running:
source ~/.zshrc # source your bashrc/zshrc to add nvm to PATH command -v nvm # check the nvm use message nvm install node # install most recent Node stable version nvm ls # list installed Node version nvm use node # use stable as current version nvm ls-remote # list all the Node versions you can install nvm alias default node # set the installed stable version as the default Node
Dependencies managers
Yarn
Yarn is a package manager developed to provide more advanced capabilities that NPM lacked at the time (such as version locking) while also making it safer, more reliable, and more efficient.
Install yarn using the following command:
brew install yarn
Pnpm
pnpm is a fast, disk space efficient package manager developed by Microsoft.
Install pnpm using the following command:
brew install pnpm
Font
macOS UpdateSystem PreferencesFirewallFileVaultAppearenceDisplaysTrackpadInternet AccountsDockControl centerSpotlightInternet Accounts Finder Software AppsDevelopment EnvironmentCommand Line Tools for XcodeHomebrewzshOh My ZshGitGlobal .gitignoteConfigure global optionsConfigure SSH access to GithubNodeDependencies managersYarnPnpmFont