macOS Specific Terminal Commands

Apple’s macOS operating system, built on a Unix foundation, offers a rich set of command-line utilities. While many commands are shared with other Unix-based systems, macOS brings its unique set of tools tailored for its environment. This article focuses on some macOS-specific terminal commands.

Table of Contents:

The power of macOS’s Unix foundation shines when delving into Terminal commands. Let’s uncover more macOS-specific commands to assist with various tasks.

System Information Commands

  • sw_vers: Display macOS version details.
  • system_profiler: Detailed report about hardware and software.
  • hostinfo: Summary of system configuration.

File Management and Spotlight

  • mdfind: Search using the Spotlight index.
  • mdls: List metadata attributes for a file.
  • SetFile and GetFileInfo: Change and view file attributes.
    • View file info:

      GetFileInfo /path/to/file
    • Hide a file in Finder:

      SetFile -a V /path/to/file

Disk Utility Commands

  • diskutil: Manage disks and volumes.
  • hdiutil: Work with disk images (ISO, DMG).
    • Mount a disk image:

      hdiutil mount /path/to/diskimage.dmg

Network Utility Commands

  • networksetup: Configure network settings.
  • airport: Interface with Wi-Fi settings.
    • View Wi-Fi network details:

      /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I

Software Management

  • softwareupdate: Interface with software update mechanism.
  • pkgutil: Manage package receipts.
  • mas: Command-line interface for the Mac App Store.
    • Search for an app:

      mas search "app name"

User and Group Management

  • dscl: Directory Service command-line utility.
    • List all users:

      dscl . -list /Users
    • Create a new user:

      sudo dscl . -create /Users/username
  • sysadminctl: Administer sysadmin accounts.
    • Add a new user:

      sudo sysadminctl -addUser username -password userpassword -admin
  • dscacheutil: Cache lookup tool.
    • Flush DNS cache:

      sudo dscacheutil -flushcache


macOS is packed with versatile terminal commands, streamlining system administration and troubleshooting tasks. Delve into each command’s manual with man commandname for deeper insights.

This post is licensed under CC BY 4.0 by the author.