How I Get-Set-Go with my MacBook Pro
I started a new job sometime back and got a brand new, blank-slate MacBook Pro. This is for the first time I was working on Macbook, so I started looking for resources that are deemed essential for a productive setup for developers.
I created a record of my system setup with the hope that it might serve as a helpful guide in others’ initial setup. Before beginning, I would like to mention that I am currently working on macOS Monterey 12.3.1 with Apple M1 Chip.
Set up System Preferences
There are a couple of tweaks that I did before starting the actual setup.
Trackpad
- System Preferences > Trackpad > Tap to click
- System Preferences > Accessibility > Mouse & Trackpad > Trackpad Options… > Enable dragging
Dock & Menu Bar
System Preferences > Dock & Menu Bar
- Change position to the Left and make the size of icons Small
- Enable automatic hide and show
- Disable show recent applications
Security and Privacy
System Preferences > Security & Privacy:
- Under General, enable require a password after sleep or screen saver begins to immediately
- Enable File Vault
Set The Terminal
The most important place where every developer spends most of the day is over the terminal. Therefore , it’s absolutely essential to get your terminal set up so you can work efficiently.
Homebrew
Homebrew provides a package management system for macOS, enabling you to quickly install and update the tools and libraries that you need. Follow the instructions as stated below
~ cd /opt
~ sudo mkdir homebrew
~ sudo chwon -R $(whoami) /opt/homebrew
~ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
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.
Since Catalina, MacOS has started using zsh
as its default shell instead of bash
. Still, I think it's better to use a different installation of zsh
to not interfere with the system version, so that’s why we install zsh
using brew
~ brew install zsh
To make installed zsh
as the default shell, we need to do the following,
~ sudo vim /etc/shells
Update /usr/local/bin/zsh
to /opt/homebrew/bin/zsh
~ chsh -s /opt/homebrew/bin/zsh
~ exec $SHELL
Restart terminal and do echo $SHELL
. This should give output as /opt/homebrew/bin/zsh
Setting PATH
To make brew
available everywhere, do the following
~ echo ‘export PATH=”/opt/homebrew/bin:$PATH”’ >>~/.zshrc
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!”.
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/robbyrussell/oh-my-zsh/master/tools/install.sh)"
You can customize your configurations, and add plugins and themes. Though I am happy with the default robbyrussell
theme, I have added the following plugins to ~/.zshrc
.
plugins=(
git
mvn
macos
docker-compose
alias-finder
)
Please feel free to explore more here
iTerm2
iTerm2 is an open-source replacement for Apple’s Terminal. It’s highly customizable and comes with a lot of useful features.
Installation
Use Homebrew to download and install:
~ brew install iterm2
Customization :
System-wide terminal accessible via a hotkey on macOS
- Go to Iterm2 Preferences (⌘ +,)
- Go to the Keys tab, and click on the Create a Dedicated Hotkey Window.
- In the panel that opens up, check the Double-tab key checkbox, and press OK.
- Congratulations, your hotkey window has now been configured and can be toggled on and off by double-pressing the Control key!
- In order to open terminal windows or tabs using the previously used location, go to the Profiles tab, select the Hotkey Window profile, select the General tab, and in the Working Directory section, click on Reuse previous session’s directory.
- Play with the settings in other tabs to customize your terminal more.
Github SSH keys
New computer, new SSH keys. Follow the Github instructions so you don’t have to type in your credentials ever again.
Note that, if you would like to configure multiple GitHub accounts with different ssh keys, please follow this link.
Did you know you can automatically ignore files in every git repo on your computer? Put them in
.gitignore_global
and never have to fuss with.DS_Store
in your.gitignore
again. I put.idea
in mine as well, since my editor of choice generates profiles in every repo.
Other Apps
These are some of the other apps which I use more often. Following is the command to install all in one go.
~ brew install --cask \
visual-studio-code \
google-chrome \
firefox \
docker \
discord \
spotify \
notion \
sublime-merge-dev \
intellij-idea \
Please don’t use
brew
to installjava
. UseSDKMAN
SDKMAN is a tool for managing parallel versions of multiple software development kits on most Unix-based systems. It provides a convenient command-line interface (CLI) and API for installing, switching, removing, and listing candidates. To install, follow the steps :
- Open a new terminal and enter:
~ curl -s "https://get.sdkman.io" | bash
- Follow the instructions on-screen to complete the installation. Next, open a new terminal or enter:
~ source "$HOME/.sdkman/bin/sdkman-init.sh"
- Lastly, run the following code snippet to ensure that the installation succeeded:
~ sdk version
- Install the latest stable version of JDK by running the following command:
~ sdk install java
- To list candidates
~ sdk list
More useful commands and usages can be found at SDKMAN Usage.
Useful Shortcuts
Show Desktop: fn F11
Show/Hide Hidden Files: ⌘ ⇧ .
Permanently Delete Files: ⌥⌘ delete
Lock screen: ⌃⌘ Q
Show or hide the Dock: ⌃ fn F3
Show all windows: ⌃ Arrow-Up
Maximize/Minimize Window: ⌃ ⌘ F
Switch between windows of same app: ⌘ `
Take a screenshot of a window: ⇧⌘ 4 + Space
Spotlight search: ⌘ Space
Character Viewer: ⌃⌘ Space
Quit an app: ⌘ Q
Lock screen: ⌃⌘ Q
Take a screenshot of a window: ⇧⌘ 4 + Space
Complete screenshot: ⇧⌘3
Conclusion
That sums up my current preferences which I consider core for setting up a MacBook Pro for a developer. There are multiple other tools available but the above are the ones that I find indispensable in getting started. I hope it helped speed up your process or gave you ideas for the next time you’re setting one up. I would love to hear about tips on other productivity tools that might be useful.