---
title: 'Reinstalling a Mac'
url: 'https://gerfficient.com/en/home/fresh-installation'
markdown: 'https://gerfficient.com/en/home/fresh-installation.md'
lang: en
date: '2024-03-14'
description: ' - Fresh installation Occasionally it makes sense to reinstall a Mac - e.g. when a new version of macOS becomes available, or if it seems that the Mac has become slower due to the constant installation and uninstallation of programs. In this case, it is recommended to create a bootable installer f…'
---

# Reinstalling a Mac

###  14. Mar. 2024 

##  - Fresh installation

Occasionally it makes sense to reinstall a Mac - e.g. when a new version of macOS becomes available, or if it seems that the Mac has become slower due to the constant installation and uninstallation of programs. In this case, it is recommended to [create a bootable installer for macOS](https://support.apple.com/en-us/101578), [use Disk Utility to erase a Mac](https://support.apple.com/en-us/102506) and then [reinstall macOS](https://support.apple.com/en-us/HT204904). These three steps are well described by Apple itself, which is why they will not be repeated here.

The terminal can then be used to finish setting up the Mac.

### Basics

First, we recommend installing [Oh My Zsh](https://ohmyz.sh):

Oh My Zsh is a responsive, open-source, community-driven framework for managing Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes and more.

```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```

### Package management

Similar to `apt` under Linux, there is also a management tool for programs and packages for macOS. It is called [Homebrew](https://brew.sh/) and is installed as follows:

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

To run Homebrew when the terminal is started, the file `.zshrc` must be added to the home directory, which is done as follows:

```
echo '' >> ~/.zprofile
echo 'if [ -e /opt/homebrew/bin/brew ]; then' >> ~/.zprofile
echo '    eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
echo 'fi' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
```

### Rosetta

Since not all programs have been compiled for Apple chips, Apple provides a translation process called [Rosetta](https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment/). This translation process makes it possible to run programs compiled for `x86_64` on a Mac with Apple chips, i.e. `arm64`. Rosetta is installed automatically as soon as it detects that an `x86_64` program is to be executed. However, you can also initiate the installation yourself:

```bash
sudo softwareupdate --install-rosetta
```

### Apps

Now Homehrew can be used to install programs or apps (in Homebrew-speak so-called "*Casks*"). For Python development I recommend `pyenv`:

```bash
brew install pyenv
```

```bash
echo '' >> ~/.zprofile
echo 'if [ -e /opt/homebrew/bin/pyenv ]; then' >> ~/.zprofile
echo '    export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zprofile
echo '    [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zprofile
echo '    eval "$(pyenv init -)"' >> ~/.zprofile
echo 'fi' >> ~/.zprofile
```

To access the Apple Store so that apps that are not provided via Homebrew can be installed via the terminal, I recommend `mas`:

```bash
brew install mas
mas install 441258766 # Magnet
mas install 497799835 # Xcode
mas install 409201541 # Pages
mas install 409203825 # Numbers
mas install 409183694 # Keynote
mas install 1501592214 # Twingate
```

And apps (or "*Casks*") that I often use are the following:

```bash
brew install --cask \
    docker \
    citrix-workspace \
    istat-menus \
    bartender \
    visual-studio-code \
    nextcloud \
    fujitsu-scansnap-home \
    devonthink \
    microsoft-excel \
    microsoft-word \
    microsoft-powerpoint \
    microsoft-teams \
    blender \
    handbrake \
    spotify \
    minecraft
```

Since I also use SDL (e.g. for Pygame), I also install the necessary binaries:

```bash
brew install sdl2 sdl2_mixer sdl2_image sdl2_ttf sdl2_gfx
```

And now the Mac is freshly set up and ready for work and coding!

### References

- [Create a bootable installer for macOS - March 2024](https://web.archive.org/web/20240314165601/https://support.apple.com/en-us/101578)
- [How to reinstall macOS - March 2024](https://web.archive.org/web/20240314165628/https://support.apple.com/en-us/HT204904)
- [Use Disk Utility to erase a Mac with Apple silicon - March 2024](https://web.archive.org/web/20240314165855/https://support.apple.com/en-us/102506)

---

## Navigation

- Parent: [Home](https://gerfficient.com/en/index.md)
- Previous: [SQLAlchemy](https://gerfficient.com/en/home/sqlalchemy.md)
- Next: [Python Developing](https://gerfficient.com/en/home/python-developing.md)
