It is a fact that there are many guides out there about how to set up a dev workspace, however, some of them are outdated or no longer fit my needs, I have collected a lot of information from some of them and created a new guide that I want to share.
As developers we need to install almost always the same set of tools for our daily basis, so this guide will go throught a list of apps, sdks, commands and many others tools that I found useful.
I have created a repository on GitHub to store the dotfiles and the installation script in case anyone wants to go straight to use it, I recommend to read the guide before though.
With this guide we will assume a clean installation of MacOs and go step by step through the installation process and a short description of each app/command/tool.
Let's open a new terminal and get started ...
Xcode
Xcode is a large suite of software development tools and libraries from Apple, even if we are not iOS/MacOs developers, this step is necessary to install Xcode command line tools which includes MacOs SDK, and many other common tools, compilers, and commands that we will need in the whole guide.
- Input the following command in a Terminal
xcode-select --install
- A system popup will appear to confirm the installation, click Install and agree the terms.
- After the process is finished, the pop-up window will look like this.
Homebrew
Homebrew is in general words a package manager for MacOs that allow us to install software that does not come installed by default. It works as a command tool, although there are some apps to use it with a graphical user interface like Cakebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Furthermore the default formulae, brew
is able to track and use third parties repos, we need to add some repos and we can do it using the brew tap 'repo'
command.
brew tap homebrew/cask
brew tap homebrew/cask-fonts
- homebrew/cask brings simplicity, and speed to the installation and management of GUI macOS applications such as Atom and Google Chrome.
- homebrew/cask-fonts As we can imagin it contains free distributed fonts
I recommend visiting and reading Hombew documentation page to solve any doubt about brew.
Let's move to install brew packages
Fonts
brew install font-meslo-lg-nerd-font
This font comes from the awesome fonts package Nerd fonts that includes developer targeted fonts such as Font Awesome, Powerline, and others. We will use this one to make our terminal pretty using icons.
By the way, we can search which fonts are included in this package by brew search nerd
and then install any other we want just changing the name of the font in the command used before.
GNU Utilities
MacOs command line tools are based on FreeBSD instead of GNU, so this could be a challenge when we want to script something supported by both platforms or if we are used to gnu commands. brew can help us installing the GNU tools, however, they come with a prefixed g
by default. We will install following tools coreutils, moreutils, findutils, gnu-sed, gawk, gnu-tar, grep, make, check their pages and decide if you want/need all of them.
brew install coreutils moreutils findutils gnu-sed gawk gnu-tar grep make
Other Command Utilities
In this section we will install other commands and utilities.
- htop: A better option than top to monitor the system.
- tree It's useful to list directories and files recursively.
-
exa: It's an alternative to the default listing command
ls
. - cowsay: Generates an ASCCI picture of a cow with a message passed by string.
- bat: A cat clone with syntax highlighting and Git integration.
- clementtsang/bottom/bottom: A graphical process/system monitor with a customizable interface and a multitude of features.
- tldr: It's an option to get the the command options and practical examples.
- jid: An utility to view and interact JSON content with a terminal.
- hiperfine: A command-line benchmarking tool.
- highlight: Converts sourcecode to HTML, XHTML, RTF, LaTeX, TeX, SVG, BBCode and terminal escape sequences with coloured syntax highlighting.
- nvim: It's an alternative vim-based editor with lots of plugins and programming languages supported.
- youtube-dl: A command-line program to download videos from YouTube and other sites.
- autojump: A faster way to navigate your filesystem
- httpie: It's a user-friendly command-line HTTP client, it comes with JSON support, syntax highlighting, persistent sessions, wget-like downloads, plugins, and more.
- thefuck: It's an app able to correct errors in previous console commands.
- golang, python, python3: Programming languages.
- kap: It's an screen recorder built with web technology.
brew install htop tree exa cowsay bat clementtsang/bottom/bottom \
vim tldr jid hyperfine highlight nvim youtube-dl autojump \
httpie thefuck golang python python3 git kap
GUI Apps
Some of the applications that we will install do not need a description, we will explain those that are probably not common or deserve to be listed.
- iterm2: An alternative to the default terminal app brings an amazing performance and customization.
- expressvpn: It's the best vpn service I have tried with lot of servers around the world and good performance.
- alfred: An app that allow to be more efficient with shortcuts, searches and own workflows.
- bitwarden: Service of security for passwords, files, credit cards, it has a nice integration and synchronization in wide list of devices.
- stats: A pretty macOS system monitor in the menu bar, includes CPU, Memory, disk, network, fans.
- notion: The app to create boards, take notes, track tasks, get organized and many othe features.
- ticktick: A To-do and habit tracker app.
- authy: 2nd Factor authentication app, it's able to get syncronized in cloud.
- dash: Useful to download and store api documentation sets.
- insomnia: An alternative to postman for design and test apis.
- kawa: A macOS input source switcher with user-defined shortcuts.
- copyq: CopyQ is advanced clipboard manager with editing and scripting features.
- calibre: It's an open source e-book manager.
brew install --cask firefox spotify iterm2 expressvpn \
alfred the-unarchiver visual-studio-code docker \
postman atom stats notion telegram ticktick zoom vlc \
intellij-idea whatsapp authy \
dash insomnia kawa copyq calibre \
microsoft-office brave-browser discord virtualbox skype
Iterm 2
Iterm2 provides a lot of features and customization is one of them, for people who have gotten used to dark mode like me, we have a lot of themes to choose from.
We will use dracula theme, for that we need to download the .itermcolors
file either by cloning the repo or downloading the zip.
Once we have the file in our filesystem we need to open Iterm2 preferences -> profile -> colors
Import the Dracula.itermcolors
downloaded before and then choose Dracula as theme
Now we will change the font to MesloLGS Nerd Font Mono the one installed in a previous step to make iterm able to show icons with powerline fonts.
P.S. Oh-my-zsh and powerlevel10k still need to be installed for Iterm to look like this.
Oh-My-Zsh
Since MacOs Catalina, zsh is the default shell on MacOs, zsh provides over 200 plugin integrations and is very similar to bash. There is a good comparison between the two here.
Oh-my-zsh is an open source and powerful community framework for managing zsh.
We can install oh-my-zsh with following command
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Or this one if we like wget
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
Plugins
Oh-my-zsh provides too many useful plugins, we are going to install a few of them.
- zsh-autosuggestion: It suggests commands as you type based on history and completions.
- zsh-syntax-highlighting: provides syntax highlighting for command type in the prompt of zsh terminal.
- fzf: It's a powerful command line finder.
- powerlevel10k: It's a theme for Zsh. It emphasizes speed, flexibility and out-of-the-box experience.
### Install zsh-autosuggestions
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
### Install zsh-syntax-highlighting
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
### Install fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
### Install powerlevel10k theme
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Once the plugins are installed, we must activate them by modifying the ~/.zshrc
file wich is the zsh configuration file.
....
plugins=(git zsh-syntax-highlighting zsh-autosuggestions fzf)
....
And this will activate powerlevel10k theme
ZSH_THEME="powerlevel10k/powerlevel10k"
Finally the .zshrc
file should looks like this.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export ZSH="/Users/user/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git zsh-syntax-highlighting zsh-autosuggestions fzf)
source $ZSH/oh-my-zsh.sh
# fzf plugin
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
We need to restart the terminal and then the powerlevel10k configuration wizard will start.
NVM
Nvm is a version manager for node js, it helps us to install different versions of node and change it easily.
We will install it by executing next command in the terminal
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
During the installation process it will try to add some exports to .zshrc
file to be able to use it. the file should include some lines like this:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completio
Once we have verified that the lines are included, we should reload the session with source ~/.zshrc
or open a new terminal window.
Now we can install any node version we want, in this case we will install the most recent lts version released
nvm install node lts
then we can check that node is installed properly
node --version
SDKMAN
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 sdkman input the following command in a new terminal
P.S. In this case we don't want to let it modify our bash files because we will do it by ourself for that we add the query param rcupdate=false
, we can remove it if we want update the files with the installation.
curl -s "https://get.sdkman.io?rcupdate=false" | bash
After the process is finished we need to add the following lines to our ~/.zshrc
file and reload the shell by source ~/.zshrc
to be able to use it.
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh"
Now we can install any sdk availble into sdman. We will install JDK, to know which versions are available we can use the list
option sdk list java
With the list obtained before we should use the column Identifier to indicare what version we want.
sdk install java 11.0.10.j9-adpt
Now we should be able to use java JDK.
There are many other sdks, we can check them here https://sdkman.io/sdks
dotfiles
These dotfiles consist of 7 files, each one with an specific purpose.
-
.aliases
: All the shortcuts for most used commands. -
.functions
: A set of useful bash functions. -
.exports
: All the exports needed for the software installed in this guide. -
.gitconfig
: Git configuration -
.gitignore
: General git ignore configuration. -
.p10k.zsh
: powerlevel10k theme configuration, this is the file generated by the theme installation. -
.zshrc
: zsh file configuration, includes plugins declaration, theme, and imports of other dotfiles.
Defaults write commands
Commands for change default MacOs preferences
Finder
# Show file extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Use list view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
Dock
# Set the icon size of Dock items to 48 pixels
defaults write com.apple.dock tilesize -int 48
# Show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true
# Speed up Mission Control animations
defaults write com.apple.dock expose-animation-duration -float 0.1
# Remove the auto-hiding Dock delay
defaults write com.apple.dock autohide-delay -float 0
# Remove the animation when hiding/showing the Dock
defaults write com.apple.dock autohide-time-modifier -float 0.1
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
Activity Monitor
# Show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
# Visualize CPU usage in the Activity Monitor Dock icon
defaults write com.apple.ActivityMonitor IconType -int 5
# Show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
# Sort Activity Monitor results by CPU usage
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0
Others
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Donβt display the annoying prompt when quitting iTerm
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
Other Apps
- Total finder: Plugin for add tabs, tags and other features to finder.
- Clean my mac: Cleaner app for MacOs.
- Pocket: App to save content to check later.
- Magnet: Window manager app.
Top comments (1)
Thanks for this amazing article!
It helped me a lot to setup my new mac :)
Looking forward for the 2022 version!