Setting up My New Macbook
I just got my hands on a brand new M3 MacBook. So, if you’re like me, maybe you’ve just unboxed your new Mac and are wondering where to start. Don’t worry; I’ve got you covered! In this guide, I’ll walk you through the steps I took to set up my Mac for software engineering, from installing essential tools to customizing system preferences. Whether you’re a seasoned developer or just starting out, I hope this guide will help streamline your setup process and get you coding in no time.
So, without further ado, let’s roll up our sleeves and turn this shiny new MacBook into a powerful development machine!
Start by installing Homebrew#
Homebrew is a free and open-source software package management system that simplifies software installation on Apple’s operating system (macOS). You can use it to install all types of packages you will need now and in the future
All you need to do is open the terminal and install Homebrew by running the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Afterwards you’ll need to run the following, to get Homebrew running on a silicon based mac
eval "$(/opt/homebrew/bin/brew shellenv)
Next up, Git#
I don’t think there is an engineer on the planet that doesn’t know what Git is, if you don’t then you are probably not using version control, so I’ll encourage you to read up on it here.
Firstly to install git, run the following in terminal:
brew install git
Now get your SSH keys configured for GitHub#
Follow these instructions to generate a new SSH key and adding it to the ssh-agent https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
And these about adding a new SSH key to your GitHub account - https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
Setup your name and email address#
From terminal, set global name and email:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Setup some useful git aliases#
Git aliases can quite useful, here are two I like to setup; a nicer formatted git log
and git branch
:
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"
git config --global alias.br "branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate"
Now use git lg
and git br
Install Node with NVM#
brew install nvm
You should create NVM’s working directory if it doesn’t exist:
mkdir ~/.nvm
Add the following to your shell profile e.g. ~/.zshrc
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
Then, restart your terminal or run source ~/.your_shell_profile
to apply the changes.
Verify that NVM is installed by running:
nvm --version
You can now use NVM to install Node.js. For example, to install the latest LTS version, run:
nvm install --lts
Now verify the the node and npm installation
node --version && npm --version
Install .Net 8 SDK#
brew install --cask dotnet-sdk
Run the following to verify the installation
dotnet --version
Install Docker#
If you work with containerized applications, Docker is a must-have tool. Install Docker Desktop for Mac:
# Install Visual Studio Code
brew install --cask visual-studio-code
# Install useful extensions
code --install-extension ms-python.python
code --install-extension esbenp.prettier-vscode
Install VS Code#
brew install --cask visual-studio-code
Install Warp#
Old me would have installed ITerm2 with Oh My Zsh and the Powerlevel10k, but Warp seems to be the new kid on the block. So far, i quite like it
brew install --cask warp
Update some system preferences#
There are some default system preferences I like to overriride from the terminal …
# 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
# Kills and restarts finder
killall Finder;
Conclusion#
Setting up a new Mac for software development can be an exciting process. By following these steps and tips, you’ll have a robust development environment tailored to your needs. Don’t hesitate to explore additional tools and configurations to further optimize your workflow and productivity.
Feel free to adjust these instructions to fit your specific preferences and requirements. Happy coding!