0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

macOS内の各種状態を入念に調べる(シェルスクリプト)

0
Last updated at Posted at 2026-08-25

こんにちは。
macOS内の各種状態を入念に調べるシェルスクリプトを作りました。

$ time ./checkv.sh
real	13m21.094s
user	0m2.005s
sys	1m3.307s

source code

check.sh
#!/bin/sh

uname -n
uname -mrs
uname -v
getconf LONG_BIT
sysctl kern.hv_support 2>/dev/null
sysctl vm.compressor_mode 2>/dev/null
du -shx / 2>/dev/null
df -h /

# Darwin
sw_vers
hostinfo 2>/dev/null
system_profiler SPHardwareDataType 2>&1
csrutil status 2>/dev/null
pmset -g
xcode-select --version 2>/dev/null
xcode-select -print-path 2>/dev/null

mdimport -L 2>/dev/null
qlmanage -m 2>/dev/null |
  sed -nE 's/^.* -> \((.*)\)$/\1/p' |
  grep -E '^/' |
  sort -u

launchctl list
nvram -p 2>/dev/null |
  grep -E 'auto-boot|BootPreference|SystemAudioVolume'
ioreg -l -p IODeviceTree 2>/dev/null |
  grep -i firmware

diskutil apfs list
tmutil listlocalsnapshots /
diskutil apfs listSnapshots /System/Volumes/Data 2>/dev/null

mdutil -sa 2>/dev/null | grep -B 1 'disabled'

mdfind -onlyin /Applications 'kMDItemAppStoreHasReceipt = 1' |
while IFS= read -r app; do
  id=$(mdls -raw -name kMDItemAppStoreAdamID "$app")
  name=$(mdls -raw -name kMDItemDisplayName "$app")
  version=$(mdls -raw -name kMDItemVersion "$app")
  printf '%s\t%s\t%s\n' "$id" "$name" "$version"
done |
sort -n |
column -t -s "$(printf '\t')"

mdfind -onlyin /Applications 'kMDItemAppStoreHasMetadataPlist = 1' |
while IFS= read -r app; do
  name=$(mdls -raw -name kMDItemDisplayName "$app")
  version=$(mdls -raw -name kMDItemVersion "$app")
  printf '%s\t%s\n' "$name" "$version"
done |
sort |
column -t -s "$(printf '\t')"

mdfind -onlyin /Applications \
  'kMDItemContentType == "com.apple.application-bundle"' |
sort

command -v mas > /dev/null && mas list | sort -n

ifconfig |
awk '
  /^[[:alnum:]][[:alnum:]_.-]*:/ {
    iface = $1
    sub(/:$/, "", iface)
  }
  $1 == "inet" && $2 ~ /^192\.168\./ {
    print iface ": " $2
  }
'
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?