Lokale KI auf dem Mac einrichten und nutzen / Setting Up and Using Local AI on Mac
… scroll down for english version …
Lokale KI auf dem Mac einrichten und nutzen
Die KI-Entwicklung schreitet schnell voran und inzwischen ist es möglich auf dem eigenen PC (am besten auf einem Mac) recht leistungsstarke KI-Modelle auszuführen. Damit vermeidet man teuere Cloud-Abos und Datenschutz-Probleme.
Ein Beispiel-Setup könnte so aussehen:
- LM Studio: Die Umgebung für das Laden und Hosten von lokalen Sprachmodellen.
- Google Gemma-4 (26B & 12B): Googles quelloffene Modellgeneration mit leistungsfähigen Reasoning- und Agenten-Fähigkeiten.
- AnythingLLM: Das Desktop-Frontend, das die lokale KI in ein agiles Arbeitswerkzeug mit Workspaces, RAG (Dokumentenanalyse) und autonomen Agenten (Agentic AI) verwandelt.
Apple hat mit der Einführung der Apple Silicon Chips (M-Serie) die perfekte Hardware-Basis für lokale Large Language Models (LLMs) geschaffen.
Das Geheimnis liegt in der Unified Memory Architecture (UMA). Im Gegensatz zu klassischen Windows-PCs, bei denen der Hauptspeicher (RAM) und der Grafikspeicher (VRAM) strikt getrennt sind, teilen sich CPU und GPU beim Mac denselben schnellen Speicherpool. Wenn der Mac also über 32 GB, 64 GB oder mehr Arbeitsspeicher verfügt, kann die Grafikeinheit fast den gesamten Speicher nutzen, um große KI-Modelle effizient zu verarbeiten. Bei herkömmlichen Grafikkarten ist oft bei 12 GB oder 16 GB VRAM Schluss – der Mac hingegen sprengt diese Grenzen mühelos.
Google hat mit der Veröffentlichung der Gemma-4 Familie einen gewaltigen Sprung nach vorne gemacht. Erstmals steht Entwicklern und Endanwendern unter der freien Apache 2.0 Lizenz ein Modell zur Verfügung, das natives Multimodal-Processing (Text, Bilder und Audio direkt im Kern verknüpft) sowie einen integrierten Reasoning Mode besitzt. Das Modell „denkt“ also vor der Ausgabe logisch nach, ähnlich wie fortgeschrittene Cloud-Modelle.
Für meinen Setup nutze ich Gemma-4 26B (MoE). Das Modell basiert auf einer hocheffizienten Mixture-of-Experts-Architektur (MoE), bei der zwar 26 Milliarden Parameter geladen sind, pro Token jedoch nur ein Teil (aktiv ca. 4B) berechnet werden muss. Das sorgt für eine gute Inferenzgeschwindigkeit bei gleichzeitig tiefem logischem Verständnis, herausragenden Coding-Eigenschaften und exzellentem strukturiertem Output.
Bei Speicherproblemen kann auch auf Gemma-4 12B zurückgegriffen werden. Dieses Modell verzichtet auf separate Encoder, leitet Bild- und Audio-Eingaben direkt in den LLM-Backbone und erreicht in Benchmarks fast die logische Tiefe des großen Bruders. Es läuft absolut flüssig auf kleineren Laptops und benötigt weniger als die Hälfte des Speichers.
Das System einrichten
Schritt 1: LM Studio installieren und das Modell laden
LM Studio dient uns als lokaler Server. Das Programm übernimmt das Laden des Modells und stellt eine lokale API bereit, die sich exakt wie die Schnittstelle von OpenAI verhält.
- Download: Besuche die offizielle Website von LM Studio und lade die Variante für macOS (Apple Silicon) herunter.
- Installation: Öffne die heruntergeladene `.dmg`-Datei und ziehe LM Studio in deinen Programme-Ordner.
- Modell suchen: Öffne die App. Klicke auf das Lupe-Symbol (Such-Reiter) in der linken Seitenleiste. gib in der Suchleiste `gemma-4-26b` ein.
- Auswahl & Download: Wähle die offizielle Version oder eine stabile Quantisierung (z. B. von Bartowski im GGUF-Format). Für einen Mac mit 32 GB RAM empfiehlt sich eine Q4_K_M oder Q5_K_M Quantisierung des 26B-Modells. Klicke auf „Download“.
- Lokalen Server starten: Wechsel auf der linken Seite zum „Local Server“-Tab (Symbol mit den Pfeilen oder dem Server-Rack).
- Wähle oben im Dropdown-Menü das geladene Gemma-4 Modell aus.
- Stelle sicher, dass der Port auf `1234` eingestellt ist.
- Klicke auf den grünen Button „Start Server“.
- In den Server-Logs siehst du nun, dass deine lokale API unter `http://localhost:1234/v1` bereitsteht. Lass LM Studio einfach im Hintergrund laufen.
Schritt 2: AnythingLLM installieren und verknüpfen
AnythingLLM ist das visuelle Cockpit, mit dem wir die KI steuern, Dokumente verwalten und Agenten losschicken.
- Download: Gehe auf die Website von AnythingLLM und lade die Desktop-App für den Mac herunter.
- Einrichtung beim ersten Start: Nach dem Öffnen begrüßt dich ein Setup-Assistent. Hier triffst du die grundlegenden Entscheidungen für die Verknüpfung:
- LLM Provider: Wähle aus der Liste „LM Studio“ aus.
- Server URL: Trage `http://localhost:1234/v1` ein (wird meistens schon automatisch vorgeschlagen).
- Token-Limit / Context Window: Gemma-4 unterstützt bis zu 256K Kontext. Für die lokale Nutzung auf dem Mac ist ein Wert zwischen `8192` und `16384` Tokens ein hervorragender Startwert, um den RAM nicht zu sprengen.
- Embedding-Provider & Vektor-Datenbank: AnythingLLM bringt eine integrierte Vektor-Datenbank (LanceDB) mit. Bestätige einfach die Standardeinstellungen – das Tool kümmert sich vollautomatisch um das Indexieren deiner Dokumente.
Sobald du das Setup abgeschlossen hast, befindest du dich auf dem Dashboard und kannst sofort deinen ersten Workspace anlegen.
Die leistungsfähigen Features von AnythingLLM
AnythingLLM ist weit mehr als nur ein einfaches Chat-Fenster. Es ist eine Betriebsumgebung für KI-Workflows. Schauen wir uns die wichtigsten Kernfeatures an, die dieses Tool in Kombination mit Gemma-4 so mächtig machen.
1. Workspaces: Strikte Datentrennung ohne „Context Bleeding“
In herkömmlichen Chat-Umsystemen wirft man oft alle Fragen in einen Topf. Das führt dazu, dass die KI Informationen aus älteren Chats mit neuen Themen vermischt. AnythingLLM löst dies durch das Konzept der Workspaces (Arbeitsbereiche).
Du kannst für jedes Projekt, jeden Kunden oder jedes private Thema einen eigenen Workspace erstellen. Ein Workspace kapselt:
- Alle hochgeladenen Dokumente und Wissensdatenbanken.
- Die spezifischen System-Prompts und Verhaltensregeln der KI.
- Die Parametereinstellungen (wie die Temperatur).
Dadurch verhinderst du effektiv das sogenannte „Context Bleeding“: Wenn du im Workspace „Steuererklärung“ arbeitest, weiß das Modell absolut nichts von den vertraulichen Quellcodes im Workspace „Software-Projekt X“.
2. Agentic AI & Native Function Calling
Mit Gemma-4 wird ein lokales Setup aktiv handlungsfähig. Während ältere lokale KI-Modelle rein reaktiv auf Texte antworteten, beherrschen die neuen Gemma-Modelle natives Function Calling. Sie können also eigenständig entscheiden, wann sie ein externes Werkzeug (Tool) benötigen, um eine Aufgabe zu lösen.
In den Einstellungen deines AnythingLLM-Workspaces kannst du den „Agent Mode“ aktivieren. Hier weisen wir Gemma-4 die Rolle eines autonomen Agenten zu. Der Agent erhält Zugriff auf mächtige Werkzeuge wie z.B. Web-Suche.
Frägst du den Agenten nun nach einer Zusammenfassung der aktuellen Tech-News, fängt Gemma-4 eigenständig an, Suchanfragen zu formulieren, die Ergebnisse zu lesen, irrelevante Links auszusortieren und dir eine saubere Synthese zu präsentieren – komplett autonom und ohne dein weiteres Zutun.
3. Fine-Tuning der LLMs über Parametereinstellungen
AnythingLLM erlaubt es, in den Workspace-Einstellungen die Systemvariablen des Modells granular zu justieren:
- System Prompt: Hier definierst du die Identität der KI. Schreibt man hier beispielsweise hinein: „Du bist ein präziser Senior Python Entwickler. Antworte ausschließlich mit optimiertem Code und verzichte auf ausschweifende Erklärungen“, wird sich Gemma-4 fortan exakt so verhalten.
- Temperatur (Temperature): Dieser Wert steuert die Kreativität und Unberechenbarkeit des Modells.
- Niedrige Temperatur (0.0 - 0.2): Die KI antwortet extrem deterministisch, faktisch und präzise. Ideal für Programmieraufgaben, mathematische Probleme oder das Abfragen von Fakten aus Dokumenten.
- Hohe Temperatur (0.7 - 1.0): Das Modell wird experimentierfreudig und kreativ. Perfekt für das Brainstorming, das Schreiben von Blog-Artikeln oder Marketing-Texten.
4. Die Desktop Help App: Dein nützlicher KI-Assistent im Alltag
Ein weiteres Highlight ist die nahtlose Integration in macOS. AnythingLLM bietet eine schlanke Desktop Help App. Per Tastendruck öffnet sich ein kompaktes Overlay über dem aktuellen Bildschirm – ganz egal, ob du gerade in Xcode, Word oder im Browser arbeitest.
Du kannst Textfragmente hineinkopieren, Code analysieren lassen oder Fragen zum aktuellen Bildschirminhalt stellen, ohne jemals deinen aktuellen Workflow unterbrechen oder ein Browser-Tab öffnen zu müssen.
Im zweiten Teil befassen wir uns mit der Möglichkeit diesen Setup für die Entwicklung von Astro-Fotos zu verwenden...
Setting Up and Using Local AI on Mac
AI development is advancing rapidly, and it is now possible to run highly powerful AI models on your own PC (ideally on a Mac). This allows you to avoid expensive cloud subscriptions and privacy issues.
An example setup could look like this:
- LM Studio: The environment for loading and hosting local language models.
- Google Gemma-4 (26B & 12B): Google's open-source model generation with powerful reasoning and agent capabilities.
- AnythingLLM: The desktop frontend that transforms the local AI into an agile work tool with workspaces, RAG (document analysis), and autonomous agents (Agentic AI).
With the introduction of Apple Silicon Chips (M-series), Apple has created the perfect hardware foundation for local Large Language Models (LLMs).
The secret lies in the Unified Memory Architecture (UMA). Unlike classic Windows PCs, where the main memory (RAM) and video memory (VRAM) are strictly separated, the Mac's CPU and GPU share the same high-speed memory pool. Therefore, if a Mac has 32 GB, 64 GB, or more of RAM, the graphics unit can utilize almost the entire memory to process large AI models efficiently. While conventional graphics cards often hit a limit at 12 GB or 16 GB of VRAM, the Mac breaks these boundaries effortlessly.
With the release of the Gemma-4 family, Google has made a massive leap forward. For the first time, developers and end-users have access to a model under the free Apache 2.0 license that features native multimodal processing (linking text, images, and audio directly in the core) as well as an integrated Reasoning Mode. This means the model "thinks" logically before providing an output, similar to advanced cloud models.
For my setup, I use Gemma-4 26B (MoE). The model is based on a highly efficient Mixture-of-Experts (MoE) architecture, where although 26 billion parameters are loaded, only a portion (approx. 4B) needs to be calculated per token. This ensures good inference speed while providing deep logical understanding, outstanding coding capabilities, and excellent structured output.
If you encounter memory issues, you can fall back to Gemma-4 12B. This model foregoes separate encoders, feeding image and audio inputs directly into the LLM backbone, and achieves logical depth in benchmarks that nearly reaches its larger sibling. It runs smoothly on smaller laptops and requires less than half the memory.
Setting Up the Local Setup
Step 1: Install LM Studio and Load the Model
LM Studio serves as our local server. The program handles loading the model and provides a local API that behaves exactly like the OpenAI interface.
- Download: Visit the official LM Studio website and download the version for macOS (Apple Silicon).
- Installation: Open the downloaded `.dmg` file and drag LM Studio into your Applications folder.
- Search for Model: Open the app. Click on the magnifying glass icon (Search tab) in the left sidebar. Type `gemma-4-26b` into the search bar.
- Selection & Download: Choose the official version or a stable quantization (e.g., from Bartowski in GGUF format). For a Mac with 32 GB of RAM, a Q4_K_M or Q5_K_M quantization of the 26B model is recommended. Click "Download."
- Start Local Server: Switch to the "Local Server" tab on the left (the icon with arrows or a server rack).
- Select the loaded Gemma-4 model from the dropdown menu at the top.
- Ensure the port is set to `1234`.
- Click the green "Start Server" button.
- You will now see in the server logs that your local API is ready at `http://localhost:1234/v1`. Simply leave LM Studio running in the background.
Step 2: Install and Link AnythingLLM
AnythingLLM is the visual cockpit used to control the AI, manage documents, and deploy agents.
- Download: Go to the AnythingLLM website and download the desktop app for Mac.
- Initial Setup: An setup assistant will greet you upon opening. Here, you make the fundamental connection decisions:
- LLM Provider: Select "LM Studio" from the list.
- Server URL: Enter `http://localhost:1234/v1` (this is usually suggested automatically).
- Token Limit / Context Window: Gemma-4 supports up to 256K context. For local use on a Mac, a value between `8192` and `16384` tokens is an excellent starting point to avoid exhausting the RAM.
- Embedding Provider & Vector Database: AnythingLLM comes with an integrated vector database (LanceDB). Simply confirm the default settings—the tool handles document indexing automatically.
Once you have completed the setup, you will be on the dashboard and can immediately create your first workspace.
The Powerful Features of AnythingLLM
AnythingLLM is much more than just a simple chat window. It is an operating environment for AI workflows. Let's look at the most important core features that make this tool so powerful in combination with Gemma-4.
1. Workspaces: Strict Data Separation without "Context Bleeding"
In traditional chat systems, people often throw all questions into one pot. This leads to the AI mixing information from older chats with new topics. AnythingLLM solves this through the concept of Workspaces.
You can create a separate workspace for every project, client, or private topic. A workspace encapsulates:
- All uploaded documents and knowledge bases.
- Specific system prompts and AI behavioral rules.
- Parameter settings (such as temperature).
This effectively prevents so-called "Context Bleeding": if you are working in the "Tax Return" workspace, the model knows absolutely nothing about the confidential source code in the "Software Project X" workspace.
2. Agentic AI & Native Function Calling
With Gemma-4, a local setup becomes actively capable of taking action. While older local AI models were purely reactive to text, the new Gemma models master native Function Calling. This means they can independently decide when they need an external tool to solve a task.
In your AnythingLLM workspace settings, you can activate "Agent Mode." Here, we assign Gemma-4 the role of an autonomous agent. The agent is granted access to powerful tools, such as web search.
If you ask the agent for a summary of current tech news, Gemma-4 will independently start formulating search queries, reading results, filtering out irrelevant links, and presenting you with a clean synthesis—entirely autonomously and without further input from you.
3. Fine-Tuning LLMs via Parameter Settings
AnythingLLM allows you to granularly adjust the model's system variables within the workspace settings:
- System Prompt: This is where you define the AI's identity. For example, if you write: "You are a precise Senior Python Developer. Respond only with optimized code and refrain from wordy explanations," Gemma-4 will behave exactly that way from then on.
- Temperature: This value controls the creativity and unpredictability of the model.
- Low Temperature (0.0 - 0.2): The AI responds extremely deterministically, factually, and precisely. Ideal for programming tasks, mathematical problems, or querying facts from documents.
- High Temperature (0.7 - 1.0): The model becomes experimental and creative. Perfect for brainstorming, writing blog articles, or marketing copy.
4. The Desktop Help App: Your Useful Everyday AI Assistant
Another highlight is the seamless integration with macOS. AnythingLLM offers a sleek Desktop Help App. With a keystroke, a compact overlay opens over your current screen—regardless of whether you are working in Xcode, Word, or a browser.
You can copy-paste text fragments, have code analyzed, or ask questions about the current screen content without ever interrupting your workflow or having to open a browser tab.
In the second part, we will deal with the possibility of using this setup for astrophotography development...