# Setting up a new Mac

I’ve just got hold of a new Mac Studio, to replace my 2017 iMac, which has started showing signs of aging. I thought it could be useful for the PhD students and postdoctoral researchers that will join my group during the next months, and will decide to buy a Mac, to write down the applications I like to install on every Mac I use, for my academic work. The focus of this document will be only on applications that are available for free. I use also proprietary software. But since this software can be found and installed via well-documented platforms provided by our university, there is little value in discussing it here.

In a series of future posts, I will also describe how I use all the applications. The instructions below may contain errors, so use them at your own risk. If you find some issues or discover that some information provided here is outdated, please let me know, and I will try to rectify it.

## Homebrew

Homebrew is a package manager for MacOS. Essentially, it allows one to install and update applications similar to a Linux distribution. We will use it to install and maintain many great tools. To install homebrew follow the instructions on the Homebrew website. Note: the homebrew installer will also download and install the Command Line Tools for Xcode, which are needed to compile source file. Homebrew allows you also to keep all your packages updated. Just type in the terminal

brew update


To verify which of the installed packages have an update version available. Then use

brew upgrade


followed by the name of the desired package, to update it.

## Fonts for terminal and other applications

I like to use the font Sauce code pro nerd font in some of my applications. Let us install it via homebrew

brew install --cask homebrew/cask-fonts/font-sauce-code-pro-nerd-font


## Alacritty and terminal improvements

Let us replace the terminal app in the MAC with something that is more configurable. I chose Alacritty, which we can install again via homebrew

brew install --cask alacritty


Alacritty can be set up via a .yml configuration file, which needs to be placed in ./config/alacritty.

Let us now make the use of the terminal (which is central in my academic work flow) a bit more pleasant. First of all, let us install oh-my-zsh, a framework for managing zsh configurations, by following the instructions in their website. Then let us use homebrew again to install powerlevel10k to make the terminal look nicer:

brew install romkatv/powerlevel10k/powerlevel10k
echo "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc  A configuration wizard will guide you through the configuration options. You can restart the wizard at any time by typing p10k configure A tool that I use very often when working on the command line is zsh-z, which allows me to jump quickly to directories that I have visited recently. This is so much more convenient than navigating my file system using the finder app. To activate this plugin, just open the file .zshrc in your home directory and replace the line plugin=(git) with the line plugin=(git z) . ## Python Let us now set up python, which has become an invaluable tool for both research and teaching. A brand new MacOS comes with its own version of python. I prefer to set one up myself for a better control. The following instructions are taken from the following excellent article. Let us first use homebrew to install pyenv, which we will use to manage the python versions. brew install pyenv  Then we use pyenv to install the desired version of python (the latest one being python 3.9.8 at the time of writing) pyenv install 3.9.8  Finally, we set this version as default python version pyenv global 3.9.8  Finally, to have control on the shell path, type the following line command echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc


which adds a similar line in the .zshrc file.

## Neovim

I currently use neovim as my editor for latex, markdown, sometimes python, and the various configuration files. It integrates very well with my terminal flow. It can as usual be installed via homebrew

brew install neovim


Neovim is highly customizable (via the Lua language), which may actually be an issue for new users. A good starting point is the following configuration file. Once you start neovim, it is a good idea to run the function :Checkhealth to verify whether additional packages should be installed.

## Tmux

Tmux is a terminal multiplexer, i.e., a tool to have multiple sessions, windows, and panes in the terminal. I use Tmux to switch between multiple tasks effectively (e.g., writing a paper and preparing some lecture notes), while keeping all the needed files opened the whole time. This is particularly useful when working on a desktop computer, since I reboot it rarely. Tmux can be installed as usual via homebrew

brew install tmux


Similar to the other programs, it can be configured via a config. file .tmux.config in the home directory.

## Doom Emacs

I use emacs mainly to

1. maintain my todo lists, keep track of deadlines, and progress towards my objectives via the fantastic org mode package,
2. to create and link notes via org-roam, and
3. to keep track of interesting papers to read via elfeed.

Emacs is highly customizable. I find Doom Emacs an excellent configuration framework, which can be used as a good starting point for customizing emacs. It also uses vim keybindings, which fits my flow nicely. To install a version of Emacs for macOS that plays well with the Doom Emacs framework, follow these instructions, which again rely on homebrew. Then proceed as described here. Doom emacs requires ripgrep and fd for fast file search. You can install both of them via homebrew

brew install ripgrep fd


## Latex

To install latex on macOS, I use MacTeX. It also installs by default Bibdesk, which is an excellent .bib file manager. I use it also to archive in an effective way the .pdf of the papers saved in my .bib file.

## Skim

Skim is a simple pdf reader that integrates well with latex, syntex, and pdfsync. This means that it supports both forward and inverse search when used as output of the compilation of a .tex file. As usual, it can be installed using homebrew

brew install --cask skim


I have tried other pdf readers: some of them such as zathura allow for dark background and vim keybindings. However, I find them less stable than skim on MacOS.

## Unison

One issue with having a desktop computer together with a laptop, is that I need to keep them synchronized. To do so, I use Unison. It can as usual be installed via homebrew

brew install unison


To use unison, one needs to create a profile file and place it in /Library/Application Support/Unison The profile file is a .prf file that contains information related to the machine that need to be synchronized as well as a list of directories over which the program will act and of files extensions to ignore.

Tags:

Categories:

Published: