Until now, my home server setup was powered by a Raspberry Pi, which had its limits since I also used it for watching TV in my office. I decided to replace it with a Mac mini, and I was fortunate to find the current M4 base model at a low price. In the following post, I will discuss the basic setup to enable remote access to the Mac mini and prepare it for the various server workloads we want to run.
I choosed the Mac mini M4 base model, which features 10 CPU and GPU cores, 16 GB of memory, and a 256 GB SSD. There are a few reasons why a Mac mini would make a good server:
In the following, we will examine the settings needed to reduce the power consumption of the Mac mini, enable remote access, and provide the basic tools for initial hacking. We will use the following system settings:
At this point, we can log in to our Mac mini via the Screen Sharing application and SSH. Before we continue, we will copy Ghostty's terminfo entry and our SSH key to the Mac mini:
infocmp -x | ssh ricos-mac-mini.local -- tic -x -
ssh-copy-id -i /Users/ricoberger/.ssh/id_rsa.pub ricoberger@ricos-mac-mini.local
scp /Users/ricoberger/.ssh/id_rsa ricoberger@ricos-mac-mini.local:/Users/ricoberger/.ssh/id_rsa
scp /Users/ricoberger/.ssh/id_rsa.pub ricoberger@ricos-mac-mini.local:/Users/ricoberger/.ssh/id_rsa.pub
Now we can log in to the Mac mini (ssh ricoberger@ricos-mac-mini.local
) and
adjust the SSH configuration to allow logins only via the copied SSH key. For
this, we add the following lines to the configuration file at
/etc/ssh/sshd_config
:
PermitRootLogin no
PasswordAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
To match the configuration on my MacBook Pro, we will install the Xcode Command Line Tools, Homebrew and our dotfiles from ricoberger/dotfiles.
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
mkdir -p /Users/ricoberger/Documents/GitHub/ricoberger
cd /Users/ricoberger/Documents/GitHub/ricoberger
git clone git@github.com:ricoberger/dotfiles.git
brew bundle install --file=Brewfile
sudo sh -c "echo $(which zsh) >> /etc/shells"
chsh -s $(which zsh)
./install.sh && source ~/.zshrc
We installed Colima as our container
runtime through the Brewfile because we want to deploy most of our services
using Docker. To autostart Colima and our services, use
brew services start colima
. We can also increase the resources of the VM
created by Colima by adjusting the following values in the Colima configuration
file at ~/.colima/default/colima.yaml
:
# Number of CPUs to be allocated to the virtual machine.
cpu: 8
# Size of the disk in GiB to be allocated to the virtual machine.
disk: 100
# Size of the memory in GiB to be allocated to the virtual machine.
memory: 12
That's it! Now we are ready to experiment with our new Mac mini home server.