DEV Community

Cover image for Setup a new mac (for devs [and others]) 💻
Dekel
Dekel

Posted on

Setup a new mac (for devs [and others]) 💻

"Got a new macbook🥳! What should I install now 🧐?"

I'm getting this question every couple of weeks from friends and colleagues, and every time I'm sending them instructions on what and how to install in order to setup their environment to make their experience better.

There are many tools/apps/configurations that you can use to make your life easier and your experience better with your mac.

So I decided to finally write everything down and share it (instead of copy&paste emails/whatsapp/slack/discord messages).

Here is my basic setup and recommendations for others.

Key repeat & delay

Change the key repeat and repeat delay - this is usually the first thing I'm changing:
image
You can find it under System Preferences -> Keyboard.

And if you like the red arrows - keep on reading 😉

Screenshots to clipboard

By default, screenshots are saved to your desktop. To change this - click ⌘+shift+5 and under the "options" menu set the "save to" to "Clipboard".

  1. To capture an area use ⌘+shift+4
  2. To capture the entire screen use ⌘+shift+5

Note: is the command key. You can find it left to your space key.

I'll start with some general tools that just make my life easier:

Rectangle

Rectangle is an open-source tool that gives you the ability to easily move the windows-apps around your desktops using your keyboard (left-half / right-half / top / bottom etc)
https://rectangleapp.com/
image

Monosnap

Monosnap is a tool to edit your screenshots. They have both paid and free versions (for personal usage).
Remember the red arrows? This is what you want:
image
https://monosnap.com/

Homebrew

This is the de-facto package manager for macos (as a developer - most of the packages you need you can install using homebrew).
Open your terminal (cmd + space) and run:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter fullscreen mode Exit fullscreen mode

AltTab

Personally, I don't use this tool, but many of my friends like it, so I decided to keep it on my list.
If you moved from Windows to MacOS - AltTab is probably your friend - it brings the power of Windows's "alt-tab" functionality to your Mac.
image
(Image from AltTab's website)
Install using brew:

brew install alttab
Enter fullscreen mode Exit fullscreen mode

iTerm2

iTerm2 is a replacement for the standard macos's terminal (and is so much better).
Now that we have homebrew installed we can use to install iterm2:

brew install iterm2
Enter fullscreen mode Exit fullscreen mode

iTerm2 configuration:

There are many settings that you can change in iterm2, here are a few that in my opinion are a must:

  1. Disable the bell: iTerm2 Preferences -> Profiles -> Terminal -> Notifications -> Silence Bell
  2. Set iterm to jump over words on option+left/right arrow and move to begin/end of line with cmd+left/right arrow. iTerm2 Preferences -> Profiles -> Keys:

  1. ⌥← (option + left arrow) - set action to "Send Escape Sequence" - Esc+ b
  2. ⌥→ (option + right arrow) - set action to "Send Escape Sequence" - Esc+ f
  3. ⌘←(cmd + left arrow) - set action to "Send Hex Code" - value is 0x01
  4. ⌘→(cmd + right arrow) - set action to "Send Hex Code" - value is 0x05

Oh My Zsh 😱

oh-my-zsh is a framework for managing zsh configurations. zsh is the default shell on macos these days.
There are hundreds themes and plugins and you can configure almost everything inside.

Lets start by installing oh-my-zsh:

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

We also need fzf for fuzzy search (some plugins need it):

brew install fzf
Enter fullscreen mode Exit fullscreen mode

Themes:

There are so many oh-my-zsh themes that you can use. I like intheloop, but you can try others and find the one that you like the most.
To set the relevant theme open your ~/.zshrc file and change the value of ZSH_THEME:

ZSH_THEME="intheloop"
Enter fullscreen mode Exit fullscreen mode

Plugins:

zsh-autosuggestions

brew install zsh-autosuggestions
echo "source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

zsh-syntax-highlighting

brew install zsh-syntax-highlighting
echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

zsh-yarn-autocompletions - not in brew, so we need to install it manually:

  1. Download the mac zip/targz file from the release age: https://github.com/g-plane/zsh-yarn-autocompletions/releases
  2. Extract it
  3. Run the following: ./install.sh $ZSH_CUSTOM/plugins
  4. Once installed - add it to your plugins section in the ~/.zshrc file:
plugins=(
# some plugins
yarn-autocompletions
)
Enter fullscreen mode Exit fullscreen mode

This is an important step - to allow running this file you need to set some permissions.
Open Finder, go to ~/.oh-my-zsh/custom/plugins/yarn-autocompletions, hold the shift key, right-click on the yarn-autocompletions file, click open (while holding the shift-key).

By default - oh-my-zsh comes with many other plugins. You just need to enable them. The complete list can be found in your ~/.oh-my-zsh/plugins folder, and you can just edit your ~/.zshrc file and add them as part of the plugins config.

Here is a good list to begin with:

plugins=(
# other plugins
aws
git
npm
yarn
zsh-interactive-cd
)
Enter fullscreen mode Exit fullscreen mode

The Fuck

The Fuck is a great tool that corrects errors in previous console commands.

Here is an example:

➜ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master


➜ fuck
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 9, done.
...
Enter fullscreen mode Exit fullscreen mode

To install just run:

brew install thefuck
Enter fullscreen mode Exit fullscreen mode

Do you think I'm missing something? Let me know in the comments.


Cover photo by Christopher Gower @ unsplash

Oldest comments (28)

Collapse
 
smeetsmeister profile image
Jelle Smeets

Awesome read! Can't believe I ever lived without Rectangle!

Collapse
 
dekel profile image
Dekel

Thanks @smeetsmeister ! I used Spectacle in the past, but since it is no longer maintained I found Rectangle to be an amazing replacement (and its also open-source!)

Collapse
 
moopet profile image
Ben Sinclair

Change the key repeat and repeat delay

Why do you do this?

Collapse
 
dekel profile image
Dekel

Mostly because I don't like waiting 😀.
Just an example - when clicking the backspace (and holding it) - I don't like to wait before characters get deleted (this is the delay until repeat configuration) , and once they start to get deleted - I like that they get deleted fast (the key repeat).

Collapse
 
moopet profile image
Ben Sinclair

There are shortcuts for "delete back a word" or "delete to end of line", etc., which I prefer. I can't remember holding a key down to do anything for years!

Thread Thread
 
dekel profile image
Dekel

There are indeed 😀 option+backspace & cmd+backspace, however sometimes I prefer to have the ability to click and hold. It really depends on the situation.

Collapse
 
dillonheadley profile image
Dillon Headley

Nice! I I’ll check out rectangle as I’ve been using spectacle. Also I use fish shell instead of zsh. Comes with autocomplete and some other nice things out of the box!

Collapse
 
eljayadobe profile image
Eljay-Adobe

My own checklist:

  • Unbox, plug-in, and boot new Mac
  • Setup network (WiFi, probably)
  • Install macOS updates
  • Install App store updates
  • Install Xcode
  • Install Brew
  • Install Vim using Brew
  • Install MacVim using Brew
  • Install boost, calc, clang-format, coreutils, dmd, doctest, dub, elm, elm-format, fdupes, findutils, gcc, gdb, git, ghc, go, icu4c, ldc, llvm, ncurses, pcre, pcre2, python (whatever the latest is... 3.9 today), range-v3, ripgrep, and sqlite using Brew
  • vi ~/.vimrc and add some of my favorite environment settings
  • vi ~/.bash_profile and add some of my favorite aliases and functions

Ready! (I'm still using Bash. I've started using Zsh, but I'm a Zsh noob.)

Collapse
 
dekel profile image
Dekel

zsh is great, and the themes/plugins give you so much. I really recommend checking them!

Collapse
 
drhyde profile image
David Cantrell

I too stick with bash, because I can't go installing zsh on the machines I use at work. I'd rather have one environment to work in than two different ones. Plus I've already got loads of bash shell customisations and porting them to work on zsh as well would be a pain.

Collapse
 
dekel profile image
Dekel

I get it. Too bad you can't install zsh (with oh-my-zsh) at work.

Thread Thread
 
duhdugg profile image
Doug Elkin

bash-it is a pretty good shameless ripoff of oh-my-zsh

Collapse
 
miketalbot profile image
Mike Talbot ⭐

For me add:

  • Yoink - somewhere to temporarily hold files that stays on screen while you move through desktops (paid, but worth it)
  • Moom - my preferred window manager (paid, but worth it for me)
  • Add the git plugin to zsh so your command prompt shows the branch you are on and other info
Collapse
 
dekel profile image
Dekel

Yoink and Moom are indeed interesting. Thanks for sharing those! I never had such need, but I might try it 😀.
As for the git plugin - I agree (and there are many more). You can also find that specific plugin in my recommended list 😉.

Collapse
 
narven profile image
Pedro Luz

To replace Yoink you also have Dropzone aptonic.com/, It does the same think has Yoink but also has extra functionality like drag and drop to anywhere... S3 server another directory, an FTP server, printer, etc

Collapse
 
baruchiro profile image
Baruch Odem

Thanks!
Try tldr.sh tool

Collapse
 
dekel profile image
Dekel

Thanks for this one. Super cool 😎!

Collapse
 
baruchiro profile image
Baruch Odem

I think I should move to oh-my-zsh. I worked with oh-my-posh or starship because they are cross platform, and I moved my configuration between computers. But I see there are incredible features in oh-my-zsh that I dreamed about

Collapse
 
dekel profile image
Dekel

I completely agree. If you still don't use oh-my-zsh - you should definitely try it!

Collapse
 
drhyde profile image
David Cantrell

Three that I find essential that no-one has mentioned are bat, direnv, and calc, all installable via homebrew.

Collapse
 
dekel profile image
Dekel
  1. bat is super cool! New to me and I should definitely give it a try.
  2. I mostly find direnv a bit less relevant for me. I use dotenv in most environments.
  3. As for calc - ipython always runs in one of my shells, and it gives me better interface for that.
Collapse
 
drhyde profile image
David Cantrell

I'm quite often switching between projects, and it's handy for each one to have its own PATH set up, its own PERL5LIB, and a few other less common things.

Collapse
 
bugb profile image
bugb

you should have dotfiles

Collapse
 
dekel profile image
Dekel

Thanks for this! I'll check it out :-)

Collapse
 
temilolufola profile image
TemiloluFola

Love this! I just moved from Windows to macOS. Will definitely them out.

Collapse
 
temilolufola profile image
TemiloluFola

Love this! I just moved from Windows to macOS. Will definitely them out.

Collapse
 
luca_predoi profile image
Luca Predoi

Nice! Coding garden has a great livestream where he sets up his new mac.

Collapse
 
hannanel100 profile image
hannanel100

Got my first Mac from my new dev job, have never used a mac before and was going crazy swiping on the trackpad to move form window to window, thanks for the recommendation for altTab, its a life saver...