Skip to content

secondlook-hub/MacTerminal

Repository files navigation

MacTerminal

A native macOS terminal emulator built with SwiftUI + AppKit.

macOS Swift

Features

  • Terminal Emulation — Full pseudoterminal (forkpty) with xterm-256color support
  • Tabs — Multi-tab interface with drag & drop reordering (Cmd+T / Cmd+W)
  • Split View — Side-by-side terminal panes within a tab (Cmd+D / Cmd+Shift+D to close)
  • SSH Bookmarks — Tree-structured connection manager with folders and subfolders
  • SSH Auto-Password — Automatically detects SSH password prompt and sends stored password (one-shot)
  • Commands — Save frequently used commands and double-click to auto-input into terminal
  • Right-Click Copy/Paste — Right-click to copy selection or paste if no selection
  • Background Tab Updates — Tabs continue processing data even when not focused, with blink indicator for unread output
  • Themes — Dark, Gray, and Light themes with sidebar support (View > Theme)
  • Line Numbers — Toggle line numbers on the left side (View > Show Line Number)
  • Timestamps — Per-line timestamps on the right side, independent per tab/window (View > Show Timestamp)
  • Logical Line Tracking — Wrapped lines are treated as a single logical line for line numbers and timestamps
  • Settings Export/Import — Export and import connections, commands, theme, and color settings (File > Settings)
  • Folder State Persistence — Sidebar folder expanded/collapsed state remembered across restarts
  • Font Zoom — Cmd + Mouse Wheel or View menu (Text Bigger/Smaller/Default Size) to resize terminal font instantly (8pt–72pt, Cmd+Plus/Minus/0)
  • NFC Normalization — File drag & drop and clipboard paste use NFC Unicode form (fixes Korean filenames)
  • Text Wrap Toggle — Turn text wrapping on/off with horizontal scrolling (View > Text Wrap)
  • Smart Double-Click — Double-click selects text between 2+ consecutive spaces (selects phrases, not just words)
  • Status Bar — Bottom bar showing logical line number (Ln) and column (Col) with selection range
  • Drag & Drop — Reorder bookmarks and move them between folders
  • Find — In-terminal search with next/previous navigation (Cmd+F)
  • Recording — Record terminal sessions to text files
  • Save Output — Export terminal content to file (Cmd+S)
  • Customization — Configurable font, background color, and text color
  • Block Selection — Toggle block selection mode for text (Cmd+B)
  • Multi-Window — Detachable terminal windows with full terminal updates in detached windows
  • Clean Shell Exitexit command properly terminates shell and all child processes without freezing
  • Process Group Cleanup — Tab close kills entire process group (shell + SSH + child processes)
  • Hidden Input Protection — Non-echoed input (passwords, etc.) is not displayed in tab titles
  • Working Directory — Starts in home directory; new tabs inherit current directory
  • Directory Tree — Right-side panel showing filesystem tree from root; auto-refreshes and highlights on cd; double-click to change directory (View > Directory Tree)
  • Shell Integration — Built-in zsh shell integration automatically reports current directory via OSC 7; directory tree highlights and scrolls to current directory on cd
  • Connection Double-Click — Double-click SSH bookmarks to connect instantly
  • List Deselect — Click empty area in connections/commands list to clear selection
  • Independent Terminal Identity — Uses own TERM_PROGRAM identifier to prevent macOS from launching the default Terminal.app
  • Auto Update — Checks for new releases via GitHub Releases API
  • Folder Access — Prompts for Desktop, Documents, Downloads folder access on first launch
  • Rename Folder Sheet — Improved folder rename UI with sheet dialog and keyboard support
  • Full Disk Access Check — Checks Full Disk Access permission on launch; shows setup guide and opens System Settings if not granted
  • Korean IME Backspace Fix — Single backspace deletes the last composing jamo (consonant) without requiring a second press
  • Input History — View and search all previously entered commands (View > Input History, Cmd+Y); double-click to re-execute; optional auto-clear on app exit
  • Developer Website — About panel shows developer blog link; Help menu includes "Visit Developer Website" to open in browser
  • Numeric Keypad Enter — Numeric keypad Enter key works the same as the main Return key
  • Preserve Scrollback on Clearclear command and \e[3J only clear the visible screen; scrollback buffer is preserved (scroll up to see history)
  • Inline Korean IME — Composing Hangul appears inline at the cursor position (like macOS Terminal.app) instead of a separate floating window
  • Per-Tab Timestamps — Timestamp visibility is independent per tab and window; toggle affects only the current tab
  • Reorder Items — Move Up/Move Down context menu for connections and commands list items
  • Crash Stability Fix — Eliminated force-unwrap crashes on empty pane lists, fixed race conditions in PTY read handler with serial queue synchronization, thread-safe onChange callbacks
  • Memory Footprint Reduction — Cursor blink now redraws only the cursor cell (not the whole view) and pauses while the window is inactive; 24-bit ANSI colors are deduped via NSCache; theme colors are computed once per theme change instead of on every property access; inputBuffer and recording-line buffers are bounded to prevent slow growth across long sessions
  • Wrap-Aware Copy — Copying a selection that spans soft-wrapped lines pastes as a single logical line in other editors; line-wrap boundaries no longer inject spurious newlines
  • Native-Speed UI — Tab switches reuse cached terminal views (scroll position, font, find-bar state preserved); the tab bar updates incrementally instead of rebuilding; PTY output is coalesced per runloop turn; sidebar list selection is instant via Button(.plain) + parallel double-tap; bookmark/command saves are debounced on a background queue; italic/bold-italic fonts are cached; plain glyphs draw without per-cell NSAttributedString allocation. Background-tab hasUpdate no longer broadcasts through ObservableObject, eliminating a per-PTY-chunk SwiftUI re-render storm

Screenshots

MacTerminal

Install

Download MacTerminal.dmg from Releases, or grab it directly from the repository.

Build from Source

git clone https://github.com/secondlook-hub/MacTerminal.git
cd MacTerminal
xcodebuild -scheme MacTerminal -configuration Release build

Requires Xcode 15+ and macOS 13.0 Ventura or later.

Keyboard Shortcuts

Shortcut Action
Cmd+T New Tab
Cmd+W Close Tab
Cmd+D Split View
Cmd+Shift+D Close Split View
Cmd+F Find
Cmd+S Save Shell Content
Cmd+Y Input History
Cmd+B Toggle Block Selection
Cmd+K Clear Scrollback
Cmd+C Copy (with selection)
Cmd+V Paste
Cmd+Plus Text Bigger
Cmd+Minus Text Smaller
Cmd+0 Text Default Size
Cmd+Scroll Font Zoom In/Out
Right-Click Copy selection / Paste (no selection)

Project Structure

MacTerminal/
├── MacTerminalApp.swift          # App entry point, menu commands
├── ContentView.swift             # Main layout (sidebar + terminal)
├── Models/
│   ├── SplitNode.swift           # Split view tree model (pane / split node)
│   ├── SSHBookmark.swift         # SSH connection data model
│   ├── SSHBookmarkStore.swift    # Tree-based bookmark persistence
│   ├── SidebarItem.swift         # Tree node (folder / bookmark leaf)
│   ├── CommandItem.swift         # Saved commands model & persistence
│   ├── ThemeManager.swift        # Theme management (Dark/Gray/Light)
│   ├── SettingsExporter.swift    # Settings export/import
│   ├── TerminalTab.swift         # Tab & split pane state management
│   ├── UpdateChecker.swift       # GitHub Releases update checker
│   ├── InputHistoryManager.swift # Input history persistence
│   └── WindowManager.swift       # Multi-window tracking
├── Terminal/
│   ├── PseudoTerminal.swift      # PTY process management (forkpty)
│   └── TerminalScreen.swift      # Terminal rendering engine
└── Views/
    ├── SplitTerminalView.swift   # Recursive split view renderer
    ├── SidebarView.swift         # Tabbed sidebar (Connections + Commands)
    ├── SSHBookmarkEditView.swift # Bookmark add/edit form
    ├── CommandEditView.swift     # Command add/edit form
    ├── DirectoryTreeView.swift   # Directory tree panel
    ├── NSTextAlignmentModifier.swift # NSTextField alignment helper
    ├── TabBarView.swift          # Tab bar with drag reordering
    ├── TerminalView.swift        # NSViewRepresentable terminal bridge
    ├── InputHistoryPanel.swift   # Input history panel
    └── DetachedWindowContent.swift

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages