April 2026 TLDR setup for Ollama + Gemma 4 on a Mac mini (Apple Silicon) — auto-start, preload, and keep-alive
- Mac mini with Apple Silicon (M1/M2/M3/M4/M5)
- At least 16GB unified memory for Gemma 4 (default 8B)
- macOS with Homebrew installed
April 2026 TLDR setup for Ollama + Gemma 4 on a Mac mini (Apple Silicon) — auto-start, preload, and keep-alive
| #!/bin/bash | |
| # With thanks to: https://www.server-world.info/en/note?os=Debian_13&p=wireguard | |
| # | |
| # How to use: | |
| # 1. Spin up a tiny virtual machine (the cheapest one with a public IP address will usually do!) with your choice | |
| # of cloud provider (Linode, Google Cloud, AWS, Azure, whoever...) and region. | |
| # 2. Run this script (you can modify it to your liking if e.g. you want to support multiple simultaneous clients. | |
| # 3. Download the /root/wireguard.conf file it creates and load it into your WireGuard client. | |
| # 4. Use e.g. icanhazip.com or ipleak.net to check and see where in the world you now appear to be! | |
| # |
One great feature of caddy-docker-proxy is that you can quickly define config rules with Docker Compose labels in each containers on the fly like Traefik, instead of at a centralized place. With this feature, we can define everything in compose files, and don't ever need to mess with a config file (Caddyfile or JSON).
Taking advantage of snippets, I created this docker-compose.yaml example so that you can quickly define routing rules and add authetication like Authelia with just 3 lines of labels below each docker container you use.
With this example, should not ever need to manually edit Caddyfile config.
When you add a new container, you just need to do this:
networks:Folder structure:
/services
/authelia
docker-compose_authelia.yml # (Includes example service with auth)
/caddy
docker-compose_caddy.yml
Dockerfile # Needed to add the CaddyDockerProxy extension
Caddyfile # Needed to contain common configurationI am pretty lazy and had to work out how I could change some files in relation to themeing a self-hosted application. Instead of adding to the codebase of the application, I decided to use Docker-Compose to mount the changes I make to the path of where they would be in the application already. This allows me to change what I like, and still be able to update and maintain the application the way I would without any changes to the codebase itself.
version: '3.3'
networks:
net:
driver: bridgeIf you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.
This should fit most setups (not mine though 😉)
ℹ️ Enable iCloud end-to-end encryption:
System settings → Apple ID → iCloud → Set Advanced Data Protection to On.System settings → Apple ID → iCloud → Disable Access iCloud Data on the Web.This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.
ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
Other options for PDFSETTINGS: