wiki:jazz/macOS

Version 5 (modified by jazz, 5 months ago) (diff)

--

macOS 筆記

csrutil

  • 只能在 Recovery Mode 底下關閉
  • 意義:System Integrity Protection (SIP)
    jazzwang:~$ csrutil 
    usage: csrutil <command>
    Modify the System Integrity Protection configuration. All configuration changes apply to the entire machine.
    Available commands:
    
        clear
            Clear the existing configuration.
        disable
            Disable the protection on the machine. Only available in Recovery OS.
        enable
            Enable the protection on the machine. Only available in Recovery OS.
        status
            Display the current configuration.
    
        netboot
            add <address>
                Insert a new IPv4 address in the list of allowed NetBoot sources.
            list
                Print the list of allowed NetBoot sources.
            remove <address>
                Remove an IPv4 address from the list of allowed NetBoot sources.
    
    
        authenticated-root
            status
                Show the current authenticated root setting.
            disable
                Allow booting from non-sealed system snapshots. Only available in Recovery OS.
            enable
                Only allow booting from sealed system snapshots. Only available in Recovery OS.
    

spotlight

  • 先確認 SIP 是 disable,再關閉 Spotlight
    jazzwang:~$ csrutil status
    System Integrity Protection status: disabled.
    jazzwang:~$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
    Password:
    
  • 參考:https://gist.github.com/adamstac/1249295

softwareupdate

  • Execute the following command to instruct a computer to download a full installer for macOS 12.2:
    softwareupdate --fetch-full-installer --full-installer-version 12.2
    

purge

  • Linux 底下可以用 vm.drop_caches=3 來清除不必要的記憶體
    sudo purge
    

dscl

  1. SSH into computer, or find and add it to Apple Remote Desktop.
  2. Run the following command:
    dscl . -append /Groups/admin GroupMembership username
    
  • Please note: An alternative method is to use the following command, but it will only work on Macs bound to Active Directory (not common)
    dseditgroup -o edit -a username -t user admin