created at 23.06.2025 ~ updated at 11.07.2025 ~ 3 min read

Command Line Tools


Helpfull command line tools for macOS

https://community.jamf.com/t5/tech-thoughts/mastering-macos-troubleshooting-with-jamf-pro-a-command-line/ba-p/359475?utm_campaign=MacAdmins.news&utm_medium=email&utm_source=MacAdmins.news_366

System tools

Get system version

sw_vers - print macOS system version information

sw_vers 
sw_vers --productVersion
sw_vers --buildVersion

List all installed system updates

softwareupdate - system software update tool

softwareupdate –-history
softwareupdate --list
softwareupdate --list-full-installers
softwareupdate --install --agree-to-license
softwareupdate --install-rosetta

Hardware information

system_profiler - reports system hardware and software configuration

system_profiler -listDataTypes
system_profiler SPHardwareDataType

Check uptime

uptime - show how long system has been running

uptime

Check dick usage

df - display free disk space

df -h

Network Troubleshooting

Get current IP and interface details

ifconfig - configure network interface parameters

ifconfig

ipconfig - view and control IP configuration state

ipconfig getsummary en0

Test DNS resolution

ping - send ICMP ECHO_REQUEST packets to network hosts

ping www.heise.de

dig - DNS lookup utility

dig heise.de

nslookup - query Internet name servers interactively

nslookup 192.168.178.1

Check default gateway

netstat - show network status

netstat -nr | grep default 

Test port connectivity

nc - arbitrary TCP and UDP connections and listens

nc -vz jschlaht.jamfcloud.com 8443 

Cronjobs and background processes

Launch Agents and Daemons

List all LaunchAgents

ls /Library/LaunchAgents 

List all LaunchDaemons

ls /Library/LaunchDaemons

Check status of a specific LaunchDaemon

sudo launchctl list | grep "com.jamf" 

Load a LaunchDaemon manually

sudo launchctl load /Library/LaunchDaemons/com.company.script.plist 

Unload a LaunchDaemon manually

sudo launchctl unload /Library/LaunchDaemons/com.company.script.plist 

MDM Profiles

Handle MDM profiles

Check MDM profile status

profiles - Profiles Tool for macOS

sudo profiles -P

List all installed profiles

profiles -C

Logs

View log messages

log - Access system wide log messages created by os_log, os_trace and other logging systems.

View MDM framework logs

log show --predicate 'eventMessage contains "mdm"' --info --last 1h

Check logs for profile installation

log show --predicate 'eventMessage contains "Profile installation failed"' --last 1h

Apps

Get apps information

Check specific app version

defaults read /Applications/Safari.app/Contents/Info CFBundleShortVersionString

FileVault and Security

Get Status

FileVault status

fdesetup - FileVault configuration tool

fdesetup status

Check Secure Token users

sysadminctl

sysadminctl -secureTokenStatus jschlaht

Gatekeeper status

spctl - SecAssessment system policy security

spctl --status

System Integrity Protection (SIP) status

csrutil – Configure system security policies

csrutil status

Cleanup Tools & Reset Commands

Clear Cache

Flush DNS cache

dscacheutil – gather information, statistics and initiate queries to the Directory Service cache.

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Clear user/system cache

rm -rf ~/Library/Caches/*
sudo rm -rf /Library/Caches/*

Reset processes and systems

Reset printing system

sudo rm -r /System/Library/Printers/ 
sudo rm -r /Library/Printers/