Skip to content

Mac Terminal (Terminal.app) - macOS Native Terminal

Ultimate macOS Terminal.app reference for native features, AppleScript, and productivity

Terminal.app is the built-in terminal emulator for macOS, providing deep integration with the operating system and offering features like AppleScript automation, Touch Bar support, and seamless integration with macOS services. While it may not have the advanced features of third-party terminals, Terminal.app excels in reliability, native macOS integration, and ease of use. This comprehensive cheat sheet covers essential shortcuts, customization options, and advanced features to maximize your productivity with macOS Terminal.

Getting Started

Opening Terminal

bash
# Launch methods
Cmd+Space "Terminal"                   # Spotlight search
Applications Utilities Terminal      # Finder navigation
Launchpad Other Terminal            # Launchpad
/Applications/Utilities/Terminal.app     # Direct path

# Quick access setup
# Dock: Drag Terminal to Dock for quick access
# Desktop: Create alias on Desktop

Basic Window Management

bash
# New window/tab
Cmd+N                                    # New window
Cmd+T                                    # New tab
Cmd+Shift+N                              # New window with same command

# Close window/tab
Cmd+W                                    # Close current tab
Cmd+Shift+W                              # Close current window
Cmd+Q                                    # Quit Terminal

# Navigate tabs
Cmd+Shift+Left/Right                     # Previous/next tab
Cmd+1-9                                  # Jump to tab number
Cmd+{/}                                  # Previous/next tab (alternative)

Essential Keyboard Shortcuts

Text Operations

bash
# Copy/Paste
Cmd+C                                    # Copy selected text
Cmd+V                                    # Paste
Cmd+Shift+V                              # Paste escaped text
Cmd+Option+V                             # Paste selection

# Selection
Double-click                             # Select word
Triple-click                             # Select line
Cmd+A                                    # Select all
Shift+Arrow                              # Extend selection

# Find and Replace
Cmd+F                                    # Find
Cmd+G                                    # Find next
Cmd+Shift+G                              # Find previous
Cmd+E                                    # Use selection for find
bash
# Scrolling
Page Up/Down                             # Page scroll
Cmd+Up/Down                              # Scroll to top/bottom
Cmd+Left/Right                           # Scroll to beginning/end of line

# History navigation
Cmd+R                                    # Show previous command in history
Up/Down arrows                           # Command history
Ctrl+R                                   # Reverse search history

# Screen management
Cmd+K                                    # Clear screen
Cmd+L                                    # Clear screen (alternative)
Ctrl+L                                   # Clear screen (shell command)

Font and Display

bash
# Font size
Cmd+Plus                                 # Increase font size
Cmd+Minus                                # Decrease font size
Cmd+0                                    # Reset to default size

# Window management
Cmd+M                                    # Minimize window
Cmd+H                                    # Hide Terminal
Cmd+Option+H                             # Hide other applications
F11                                      # Toggle full screen

Profiles and Customization

Profile Management

bash
# Access profiles
Terminal Preferences Profiles        # Profile settings
Cmd+,                                    # Open preferences

# Profile operations
# Duplicate profile: Select profile → Gear icon → Duplicate
# Import profile: Gear icon → Import
# Export profile: Gear icon → Export

# Set default profile
# Select profile → Default button

Creating Custom Profiles

bash
# Profile settings categories
Text:
- Font family, size, and style
- Character and line spacing
- Text rendering options
- Cursor style and blinking

Window:
- Window size and position
- Background color and opacity
- Background image
- Blur and vibrancy effects

Shell:
- Startup command
- Working directory
- Environment variables
- Shell exit behavior

Keyboard:
- Key mappings
- Option key behavior
- Function key behavior
- Delete key behavior

Advanced:
- Terminal type (TERM variable)
- Character encoding
- Scrollback buffer size
- Bell settings
bash
# Development Profile
Name: Development
Font: SF Mono, 14pt
Background: Dark gray (#1e1e1e)
Text: Light gray (#d4d4d4)
Cursor: Block, blinking
Scrollback: 10000 lines
Working Directory: ~/Development

# Server Profile
Name: Server
Font: Menlo, 12pt
Background: Black
Text: Green (#00ff00)
Cursor: Underline
Bell: Visual bell only
Title: Server - %host%

# Presentation Profile
Name: Presentation
Font: SF Mono, 18pt
Background: White
Text: Black
Cursor: Block, non-blinking
Window: Large (120x40)

Advanced Features

AppleScript Integration

applescript
-- Basic Terminal control
tell application "Terminal"
    activate
    do script "ls -la"
end tell

-- Create new window with command
tell application "Terminal"
    do script "cd ~/Documents && ls" in window 1
end tell

-- Multiple commands
tell application "Terminal"
    set newTab to do script "cd ~/Projects"
    do script "git status" in newTab
    do script "npm start" in newTab
end tell

-- Window management
tell application "Terminal"
    set bounds of front window to {100, 100, 800, 600}
    set background color of front window to {0, 0, 0}
end tell

-- Profile switching
tell application "Terminal"
    set current settings of front window to settings set "Pro"
end tell

Automation Scripts

bash
# Create Terminal automation script
#!/usr/bin/osascript
tell application "Terminal"
    activate
    
    -- Development environment setup
    set devTab to do script "cd ~/Development"
    do script "git status" in devTab
    
    -- Start development server
    set serverTab to do script "cd ~/Development/myapp"
    do script "npm start" in serverTab
    
    -- Open logs
    set logTab to do script "cd ~/Development/myapp"
    do script "tail -f logs/app.log" in logTab
end tell

# Save as .scpt file and run with:
osascript development-setup.scpt

Touch Bar Support

bash
# Touch Bar customization (macOS with Touch Bar)
# Available in Terminal → View → Customize Touch Bar

# Default Touch Bar items
- New Tab
- Split View
- Profiles
- Font Size
- Full Screen

# Custom Touch Bar setup
1. View Customize Touch Bar
2. Drag desired items to Touch Bar
3. Arrange in preferred order
4. Click Done

Services Integration

bash
# macOS Services with Terminal
# Available in any app: App Menu → Services

# New Terminal at Folder
# Right-click folder in Finder → Services → New Terminal at Folder

# New Terminal Tab at Folder
# Right-click folder in Finder → Services → New Terminal Tab at Folder

# Custom services (Automator)
1. Open Automator
2. New Service
3. Add "Run Shell Script" action
4. Set input to "files or folders"
5. Save service

Shell Integration

Shell Configuration

bash
# Default shell settings
# Terminal → Preferences → General → Shells open with

Options:
- Default login shell (/bin/zsh)
- Command: /bin/bash
- Command: /usr/local/bin/fish

# Shell-specific configurations
# Zsh (default macOS shell)
~/.zshrc                                 # Zsh configuration
~/.zprofile                              # Zsh login configuration

# Bash
~/.bash_profile                          # Bash login configuration
~/.bashrc                                # Bash configuration

# Environment variables
export TERM=xterm-256color               # Terminal type
export CLICOLOR=1                        # Enable colors
export LSCOLORS=ExFxBxDxCxegedabagacad   # ls colors

Prompt Customization

bash
# Zsh prompt (in ~/.zshrc)
# Simple prompt
PS1="%n@%m %1~ %# "

# Colorful prompt
PS1="%F{green}%n@%m%f %F{blue}%1~%f %# "

# Git-aware prompt
autoload -Uz vcs_info
precmd() { vcs_info }
zstyle ':vcs_info:git:*' formats ' (%b)'
setopt PROMPT_SUBST
PS1='%F{green}%n@%m%f %F{blue}%1~%f%F{red}${vcs_info_msg_0_}%f %# '

# Bash prompt (in ~/.bash_profile)
export PS1="\u@\h \W $ "

# Colorful bash prompt
export PS1="\[\033[32m\]\u@\h\[\033[00m\] \[\033[34m\]\W\[\033[00m\] $ "

Window and Tab Management

Window Operations

bash
# Window creation
Cmd+N                                    # New window
Cmd+Shift+N                              # New window with same command
Option+Cmd+N                             # New window with same working directory

# Window arrangement
Window Arrange in Front               # Bring all windows forward
Window Merge All Windows              # Combine windows into tabs

# Split view (macOS)
View Show Tab Bar                     # Show tab bar
Drag tab out of window                  # Create new window
Drag tab to another window              # Merge windows

Tab Management

bash
# Tab operations
Cmd+T                                    # New tab
Cmd+W                                    # Close tab
Cmd+Shift+W                              # Close window

# Tab navigation
Cmd+Shift+Left/Right                     # Previous/next tab
Cmd+1-9                                  # Jump to tab number
Cmd+{/}                                  # Previous/next tab

# Tab customization
# Right-click tab → Rename Tab
# Right-click tab → Duplicate Tab
# Right-click tab → Move Tab to New Window

Inspector and Debugging

bash
# Terminal Inspector
Shell Show Inspector                   # Show window inspector
Cmd+I                                    # Toggle inspector

# Inspector information
- Process information
- Window dimensions
- Character encoding
- Terminal type
- Working directory
- Command history

# Debug information
View Show Tab Bar                     # Show tab information
View Show All Tabs                    # Show all tab titles

Customization and Themes

Color Schemes

bash
# Built-in themes
- Basic
- Pro (dark theme)
- Grass (green on black)
- Homebrew (amber on black)
- Man Page (black on white)
- Novel (sepia tones)
- Ocean (blue theme)
- Red Sands (red theme)
- Silver Aerogel (light theme)
- Solid Colors (various solid backgrounds)

# Custom color configuration
Terminal Preferences Profiles [Profile] → Text
- Text color
- Bold text color
- Background color
- Selection color
- Cursor color

Font Configuration

bash
# Font settings
Terminal Preferences Profiles [Profile] → Text

# Recommended fonts for programming
- SF Mono (system default)
- Menlo (classic macOS)
- Monaco (classic Mac)
- JetBrains Mono (with ligatures)
- Fira Code (with ligatures)
- Source Code Pro
- Inconsolata

# Font features
- Font family and size
- Character spacing
- Line spacing
- Anti-aliasing
- Use bold fonts
- Allow blinking text

Background Customization

bash
# Background options
Terminal Preferences Profiles [Profile] → Window

# Background types
- Solid color
- Color and transparency
- Background image
- Built-in patterns

# Transparency effects
- Opacity slider (0-100%)
- Blur background
- Use vibrancy (macOS visual effects)

# Background image settings
- Image file selection
- Scaling options (Stretch, Tile, Center, etc.)
- Image opacity

Security Features

Secure Keyboard Entry

bash
# Enable secure input
Terminal Secure Keyboard Entry         # Toggle secure input

# When enabled:
- Prevents other applications from reading keystrokes
- Useful for entering passwords
- Indicated by lock icon in menu bar
- Automatically disabled when Terminal loses focus

Profile Security

bash
# Secure profile settings
Terminal Preferences Profiles [Profile] → Shell

# Security options
- Prompt before closing if processes are running
- Prompt before closing if shell is running
- Ask before closing terminal
- Warn when shell exits abnormally

# Environment security
- Avoid storing sensitive data in environment variables
- Use secure methods for credential storage
- Regular profile cleanup

Integration with macOS

Finder Integration

bash
# Open Terminal from Finder
# Enable: System Preferences → Keyboard → Shortcuts → Services
# Check "New Terminal at Folder" and "New Terminal Tab at Folder"

# Usage
Right-click folder Services New Terminal at Folder
Right-click folder Services New Terminal Tab at Folder

# Custom Finder toolbar
1. View Customize Toolbar in Finder
2. Drag Terminal icon to toolbar
3. Click folder, then Terminal icon

Spotlight Integration

bash
# Terminal in Spotlight
Cmd+Space "Terminal"                   # Launch Terminal
Cmd+Space "term"                       # Quick launch

# Index Terminal content
# Terminal history is not indexed by Spotlight
# Use shell history search instead (Ctrl+R)

Notification Center

bash
# Terminal notifications
# Configure in System Preferences → Notifications → Terminal

# Notification triggers
- Process completion (long-running commands)
- Bell character (ASCII 7)
- Custom notifications via osascript

# Custom notification script
#!/bin/bash
osascript -e 'display notification "Command completed" with title "Terminal"'

Troubleshooting

Common Issues

bash
# Font rendering problems
# Try different fonts or adjust anti-aliasing
Terminal Preferences Profiles Text Font

# Color display issues
# Check color profile and terminal type
echo $TERM                               # Should show xterm-256color
export TERM=xterm-256color               # Set if needed

# Keyboard input problems
# Reset keyboard settings
Terminal Preferences Profiles Keyboard Restore Defaults

# Performance issues
# Reduce scrollback buffer
Terminal Preferences Profiles Advanced Scrollback

Reset and Recovery

bash
# Reset Terminal preferences
# Quit Terminal completely
rm ~/Library/Preferences/com.apple.Terminal.plist
# Restart Terminal

# Reset specific profile
Terminal Preferences Profiles [Profile] → Restore Defaults

# Clear Terminal history
history -c                               # Clear current session
rm ~/.zsh_history                        # Clear zsh history (if using zsh)
rm ~/.bash_history                       # Clear bash history (if using bash)

Debug Mode

bash
# Enable debug logging
# Add to shell configuration file
export TERM_DEBUG=1

# View system logs
Console.app System Reports Terminal

# Terminal crash logs
~/Library/Logs/DiagnosticReports/Terminal_*

Tips and Best Practices

Productivity Tips

bash
# Quick profile switching
# Create keyboard shortcuts for different profiles
# System Preferences → Keyboard → Shortcuts → App Shortcuts
# Add shortcuts for Terminal → Shell → New Window/Tab → [Profile]

# Efficient tab management
# Use descriptive tab titles
# Right-click tab → Rename Tab
# Use Cmd+1-9 for quick tab switching

# Command history optimization
# Increase history size in shell configuration
export HISTSIZE=10000                    # Number of commands in memory
export HISTFILESIZE=20000                # Number of commands in history file

Workflow Integration

bash
# Development workflow
# Create profiles for different projects
# Use AppleScript for environment setup
# Integrate with version control systems

# System administration
# Create secure profiles for server access
# Use key-based authentication
# Implement logging and audit trails

# Automation
# Use shell functions for common tasks
# Create aliases for frequently used commands
# Implement custom services for Finder integration

Customization Best Practices

bash
# Profile organization
# Create profiles for different purposes
# Use descriptive names
# Export profiles for backup

# Color scheme selection
# Choose high contrast for readability
# Consider accessibility requirements
# Test in different lighting conditions

# Font selection
# Use monospace fonts for programming
# Consider font size for screen resolution
# Enable ligatures for modern coding fonts

Terminal.app provides a solid, reliable terminal experience that integrates seamlessly with macOS. While it may lack some advanced features found in third-party terminals, its native integration, AppleScript support, and robust customization options make it an excellent choice for Mac users who value simplicity and system integration. The deep macOS integration, combined with features like Touch Bar support and Services integration, creates a cohesive workflow that feels natural within the Apple ecosystem.