Skip to content

bcharleson/xai-grok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Grok for Mac

Grok for Mac

The Native macOS Client for xAI's Grok

A free, open-source, lightning-fast native Mac app for chatting with Grok AI

License: MIT macOS 14.0+ Swift 5.9+ Xcode 15+

Download Β· Features Β· Getting Started Β· Build from Source Β· Contributing


Watch the Demo

🎬 Watch the Full Demo on YouTube β€” See Grok for Mac in action!


πŸš€ What is Grok for Mac?

Grok for Mac is a native macOS application that gives you direct access to xAI's powerful Grok AI models right from your desktop. No browser needed β€” just pure, fast, native performance.

Unlike web-based alternatives, this app is built entirely in Swift and SwiftUI, optimized specifically for macOS. It's lightweight (~15MB), blazing fast, and integrates seamlessly with your Mac workflow.

Why a Native Mac App?

  • ⚑ Lightning-fast performance β€” Native SwiftUI rendering, no browser overhead
  • 🎯 Instant access β€” Summon Grok from anywhere with a global hotkey (βŒ˜β‡§G)
  • πŸ”— Deep Mac integration β€” Works with your existing Mac apps and workflows
  • πŸ’Ύ Local data β€” Your conversations stay on your machine, not in the cloud
  • 🎨 Native experience β€” Feels like a Mac app because it is a Mac app
  • βš™οΈ System-level features β€” Menu bar icon, keyboard shortcuts, Spotlight-style access

⚠️ Note: This is an unofficial, community-built app. Grok is a product of xAI. You'll need your own xAI API key to use this app.


✨ Features

πŸ€– Full Grok Model Support

Access all available Grok models through the xAI API:

Model Best For Context Window
Grok 4 Complex reasoning, analysis 256K tokens
Grok 4.1 Fast Speed + quality balance 2M tokens
Grok 3 General purpose 131K tokens
Grok 3 Mini Quick responses, cost-effective 131K tokens
Grok 2 Vision Image analysis 128K tokens
Grok Code Programming assistance 128K tokens

⌨️ Customizable Global Hotkeys

Summon Grok from anywhere on your Mac instantly:

  • βŒ˜β‡§G (Command+Shift+G) β€” Default hotkey
  • Fully customizable β€” Set your own: Option+Space, Control+Space, Option+G, or any combination
  • Works from any app β€” Summon Grok without switching windows
  • Spotlight-style access β€” Quick input window appears instantly

πŸ”„ Four Powerful Modes

Mode Description Best For
𝕏 Mode Dedicated X/Twitter integration Your profile, feed interaction, and social media workflows
Grok Mode Native SuperGrok access General AI assistance without browser overhead
πŸ‘¨β€πŸ’» Code Mode Agentic coding assistant Creating files, writing code, modifying files locally on your Mac
πŸ“š Grokipedia Research & knowledge base Deep research, fact-checking, and knowledge exploration

πŸ”— Transfer Between Modes

Unique workflow feature β€” Seamlessly move content between modes:

  • Transfer to Code button β€” Located to the right of the refresh button
  • Select text from Chat/Grok modes and transfer to Code mode
  • Use cases:
    • Clone repositories and work with local files
    • Feed research content into local development workflows
    • Create and modify files directly on your Mac
    • Combine AI reasoning with local file operations

πŸ’¬ Developer Chat Mode

A powerful chat interface designed for developers:

  • Markdown rendering with full syntax highlighting
  • Code blocks with copy button and language detection
  • Conversation history β€” saved locally, searchable, exportable
  • Multi-turn conversations with full context preservation
  • Transfer to Code β€” Move content to Code mode for local file operations

πŸ”’ Secure by Design

Your data stays on your machine:

  • API key stored in macOS Keychain β€” Not in plain text
  • No telemetry or tracking β€” We don't collect any data
  • Local conversation history β€” Nothing leaves your Mac
  • Safety Mode β€” Optional protection against destructive commands

πŸ“Š Cost & Usage Tracking

Stay on top of your API usage:

  • Real-time token counting β€” Input and output tokens
  • Cost estimation β€” Based on current xAI pricing
  • Context window indicator β€” Know when you're approaching limits
  • Per-model pricing β€” Automatically calculated

🎨 Native macOS Experience

Built for Mac, not ported:

  • Native SwiftUI interface β€” Feels right at home on macOS
  • Dark/Light mode β€” Follows system appearance
  • Menu bar icon β€” Quick access without opening the full app
  • Auto-updates β€” Sparkle framework keeps you current
  • Keyboard shortcuts β€” Full macOS keyboard navigation

πŸ“¦ Installation

Option 1: Download DMG (Recommended)

  1. Download the latest Grok-X.X.X.dmg from Releases
  2. Open the DMG file
  3. Drag Grok.app to your Applications folder
  4. Launch Grok from Applications

First Launch: macOS may show a security warning. Right-click the app β†’ Open β†’ Open to bypass Gatekeeper.

Option 2: Build from Source

See Build from Source below.


🏁 Getting Started

1. Get Your API Key

  1. Go to console.x.ai
  2. Sign in with your xAI/X account
  3. Create a new API key
  4. Copy the key (starts with xai-...)

2. Configure the App

  1. Launch Grok for Mac
  2. Open Settings (⌘,)
  3. Go to the Grok Code tab
  4. Paste your API key
  5. (Optional) Customize your global hotkey
  6. Close Settings β€” you're ready!

3. Start Using Grok

Choose your mode based on your workflow:

  • 🎯 Quick Access β€” Press βŒ˜β‡§G to summon Grok from anywhere
  • 𝕏 Mode β€” Access your X/Twitter profile and feed
  • Grok Mode β€” General AI assistance and SuperGrok features
  • πŸ‘¨β€πŸ’» Code Mode β€” Agentic coding with local file operations
  • πŸ“š Grokipedia β€” Research and knowledge base queries

Pro Tip: Use the Transfer to Code button to move content between modes and work with local files!


⌨️ Keyboard Shortcuts

Action Shortcut
Global Hotkey βŒ˜β‡§G (customizable)
Settings ⌘,
New Chat ⌘N
Close Window ⌘W
Minimize ⌘M
Quit ⌘Q
Copy ⌘C
Paste ⌘V
Select All ⌘A
Back ⌘[
Forward ⌘]
Reload ⌘R

πŸ”§ Settings & Configuration

Access Settings via ⌘, or the menu bar.

General Tab

Setting Description
Launch at Login Start Grok when you log in
Show in Menu Bar Display icon in menu bar for quick access
Auto-check for Updates Keep the app up to date automatically
Global Shortcut Choose your preferred hotkey

Grok Code Tab

Setting Description
API Key Your xAI API key (stored in Keychain)
Safety Mode Block potentially destructive commands
Chat Retention How long to keep chat history (Forever/7 days/30 days)
Model Selection Choose your preferred Grok model for Code mode

πŸ›  Build from Source

Prerequisites

  • macOS 14.0 (Sonoma) or later
  • Xcode 15.0 or later
  • Swift 5.9 or later
  • An xAI API key

Build Steps

# Clone the repository
git clone https://github.com/bcharleson/xai-grok.git
cd xai-grok

# Open in Xcode
cd GrokChat
open GrokApp.xcodeproj

Then in Xcode:

  1. Select the Grok scheme
  2. Choose My Mac as the destination
  3. Press ⌘R to build and run

Command Line Build

cd GrokChat

# Build release version
xcodebuild -project GrokApp.xcodeproj \
           -scheme Grok \
           -configuration Release \
           build

# Find the built app
open ~/Library/Developer/Xcode/DerivedData/*/Build/Products/Release/

Create a DMG

# Use the included build script
./build-dmg.sh

πŸ“ Project Structure

xai-grok/
β”œβ”€β”€ GrokChat/                      # Main app directory
β”‚   β”œβ”€β”€ Sources/
β”‚   β”‚   β”œβ”€β”€ AppDelegate.swift      # App lifecycle, window management
β”‚   β”‚   β”œβ”€β”€ DeveloperRootView.swift # Developer chat UI (SwiftUI)
β”‚   β”‚   β”œβ”€β”€ SettingsWindow.swift   # Settings panel
β”‚   β”‚   β”œβ”€β”€ InputWindow.swift      # Quick input window
β”‚   β”‚   β”œβ”€β”€ Managers/
β”‚   β”‚   β”‚   β”œβ”€β”€ HotKeyManager.swift    # Global hotkey handling
β”‚   β”‚   β”‚   └── UpdateManager.swift    # Sparkle auto-updates
β”‚   β”‚   └── Utils/
β”‚   β”‚       └── KeychainHelper.swift   # Secure credential storage
β”‚   β”œβ”€β”€ Tests/
β”‚   β”‚   └── GrokChatTests.swift    # Unit tests
β”‚   β”œβ”€β”€ GrokApp.xcodeproj/         # Xcode project
β”‚   β”œβ”€β”€ Package.swift              # Swift Package Manager
β”‚   β”œβ”€β”€ Info.plist                 # App configuration
β”‚   β”œβ”€β”€ appcast.xml                # Sparkle update feed
β”‚   β”œβ”€β”€ bin/                       # Sparkle tools
β”‚   β”œβ”€β”€ build.sh                   # Build script
β”‚   β”œβ”€β”€ build-dmg.sh               # DMG creation script
β”‚   └── release.sh                 # Release automation
β”œβ”€β”€ .github/
β”‚   └── PULL_REQUEST_TEMPLATE.md
β”œβ”€β”€ logo/                          # App icons and branding
β”œβ”€β”€ LICENSE                        # MIT License
β”œβ”€β”€ README.md                      # This file
└── CONTRIBUTING.md                # Contribution guidelines

πŸ”§ Technical Details

Component Technology
Language Swift 5.9+
UI Framework SwiftUI + AppKit
Minimum macOS 14.0 (Sonoma)
API Communication URLSession with streaming support (SSE)
Credential Storage macOS Keychain
Preferences UserDefaults
Auto-Updates Sparkle 2.x
Markdown Rendering AttributedString + custom parser
Code Highlighting Custom Swift syntax highlighter
Global Hotkeys HotKey framework

Code Mode: Agentic Coding Assistant

The Code Mode is a powerful agentic assistant designed for developers:

  • Create files β€” Generate new files directly on your Mac
  • Write code β€” Full code generation with syntax highlighting
  • Modify files β€” Edit existing files with AI assistance
  • Local operations β€” All file operations happen on your machine
  • Repository integration β€” Clone repos and work with local projects
  • Transfer content β€” Move research from other modes into Code mode

API Integration

The app communicates directly with the xAI API:

  • Endpoint: https://api.x.ai/v1/chat/completions
  • Streaming: Server-Sent Events (SSE) for real-time responses
  • Models: Fetched dynamically from /v1/models
  • Pricing: Automatically calculated per model
  • Authentication: API key stored securely in macOS Keychain

🀝 Contributing

We welcome contributions! Whether it's bug fixes, new features, or documentation improvements.

Quick Start

  1. Fork the repository
  2. Clone your fork locally
  3. Create a feature branch (git checkout -b feature/amazing-feature)
  4. Make your changes
  5. Test thoroughly
  6. Commit (git commit -m 'Add amazing feature')
  7. Push (git push origin feature/amazing-feature)
  8. Open a Pull Request

Guidelines

  • Follow Swift style conventions
  • Add tests for new functionality
  • Update documentation as needed
  • Keep commits focused and atomic

See CONTRIBUTING.md for detailed guidelines.


πŸ› Troubleshooting

"App can't be opened because it is from an unidentified developer"

Right-click the app β†’ Open β†’ Open. This bypasses Gatekeeper for this app.

API key not working

  • Ensure your key starts with xai-
  • Check that you have API credits at console.x.ai
  • Try regenerating your API key

Global hotkey not working

  • Check System Settings β†’ Privacy & Security β†’ Accessibility
  • Ensure Grok has permission to control your computer
  • Try a different hotkey combination in Settings

High memory usage

  • Use "Clear All Chats" in Settings to remove old conversations
  • Set a retention policy (7 or 30 days) to auto-delete old chats

πŸ“„ License

This project is licensed under the MIT License β€” see LICENSE for details.

MIT License

Copyright (c) 2025 Brandon Charleson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software...

πŸ‘¨β€πŸ’» Author

X/Twitter GitHub

Brandon Charleson β€” Creator & Maintainer


πŸ™ Acknowledgments

  • xAI β€” For creating Grok and providing the API
  • Sparkle β€” For the excellent auto-update framework
  • HotKey β€” For global hotkey support
  • Community Contributors β€” Thank you for making this project better!

⚠️ Disclaimer

This is an unofficial, community-built application.

  • Grok is a product of xAI
  • This project is not affiliated with, endorsed by, or sponsored by xAI
  • You are responsible for your own API usage and costs
  • Use at your own risk

⭐ Star this repo if you find it useful!

⭐ Star Β· πŸ› Report Bug Β· πŸ’‘ Request Feature Β· 🍴 Fork


Made with ❀️ for the Mac community

About

Native Grok app for macOS

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published