# system

* [account](#account)
  * [mark account to admin](#mark-account-to-admin)
  * [check account](#check-account)
  * [list all accounts](#list-all-accounts)
  * [guest account](#guest-account)
  * [enable root user](#enable-root-user)
  * [add account](#add-account)
* [system tools](#system-tools)
  * [`hostinfo`](#hostinfo)
  * [get human-readable vm\_stat](#get-human-readable-vm_stat)
  * [show system info](#show-system-info)
  * [show memory](#show-memory)
  * [show adapter](#show-adapter)
  * [show Mach virtual memory statistics](#show-mach-virtual-memory-statistics)
  * [check process without interactive mode](#check-process-without-interactive-mode)
* [show system](#show-system)
  * [Serial Number](#serial-number)
  * [hardware](#hardware)
  * [memory](#memory)
  * [swap usage](#swap-usage)
  * [show kernel version](#show-kernel-version)
  * [show resolution](#show-resolution)
  * [list printer status](#list-printer-status)
  * [plist file](#plist-file)
* [osx installation](#osx-installation)
  * [download older version](#download-older-version)
  * [create osx installer usb](#create-osx-installer-usb)
  * [boot with macOS USB installer](#boot-with-macos-usb-installer)
  * [Convert a MacOS Installer to ISO](#convert-a-macos-installer-to-iso)
* [flushed](#flushed)
  * [disk cache](#disk-cache)
  * [flush DNS](#flush-dns)
* [clean OSX native dot file](#clean-osx-native-dot-file)
* [launchctl](#launchctl)
  * [create new plist](#create-new-plist)
* [printer](#printer)
  * [Xerox WorkCentre 7545](#xerox-workcentre-7545)
  * [Xerox VersaLink C7130 Multifunction Printer](#xerox-versalink-c7130-multifunction-printer)
* [profiles](#profiles)
  * [prints all configuration profiles](#prints-all-configuration-profiles)
  * [show expanded information for profiles](#show-expanded-information-for-profiles)
  * [shwo device enrollment configuration](#shwo-device-enrollment-configuration)
* [log](#log)
  * [check log stream](#check-log-stream)
* [Q\&A](#qa)
  * [`SUPreferenceManager: Failed to set object of class: __NSCFString`](#supreferencemanager-failed-to-set-object-of-class-__nscfstring)

### account

#### mark account to admin

> \[!TIP|label:references:]
>
> * [Using Command Line how to make the user an Administrator](https://apple.stackexchange.com/a/268602/254265)
> * [Making a user account an administrator on Mac (Terminal)](https://teamdynamix.umich.edu/TDClient/47/LSAPortal/KB/ArticleDet?ID=1981)
> * [macOS Remove Admin Account with Terminal](https://clickpom.zendesk.com/hc/fr/articles/4407270628109-macOS-Remove-Admin-Account-with-Terminal)

```bash
$ sudo dscl . -merge /Groups/admin GroupMembership <username>
# i.e.
$ sudo dscl . -merge /Groups/admin GroupMembership marslo

# check
$ sudo dscl . -read /Groups/admin GroupMembership

# remove
$ sudo dscl . -delete /Groups/admin GroupMembership <username>
# -- or --
$ sudo dseditgroup -o edit -d <username> -t user admin
```

**modify SHELL**

```bash
# for current account
$ chsh -s $(command -v bash)
$ sudo bash -c "echo $(command -v bash) >> /etc/shells"

# or for `<username>`
$ sudo chsh -s $(command -v bash) <username>
$ sudo bash -c "echo $(command -v bash) >> /etc/shells"
```

#### check account

* check admin accounts

  ```bash
  $ sudo dscl . -read /Groups/admin GroupMembership
  GroupMembership: root _avectodaemon marslo

  # or
  $ id -Gn <username>
  $ id -Gn <username> | grep -qw admin
  ```
* check account info

  ```bash
  $ dscacheutil -q user -a name marslo
  name: marslo
  password: ********
  uid: 503
  gid: 20
  dir: /Users/marslo
  shell: /usr/local/bin/bash
  gecos: Marslo Jiao

  # or
  $ sudo dscl . -read /Users/marslo
  ```
* read account from plist

  ```bash
  $ sudo defaults read /var/db/dslocal/nodes/Default/users/<account>.plist
  ```
* check account AuthenticationAuthority

  ```bash
  $ sudo dscl . -read /Users/<username> AuthenticationAuthority
  AuthenticationAuthority: ;ShadowHash;HASHLIST:<SALTED-SHA512-PBKDF2,SRP-*******-****-SHA512-PBKDF2> ;Kerberosv5;;marslo@LKDC:SHA1.37************************************83;LKDC:SHA1.37************************************83; ;SecureToken;

  $ sudo dscl . -read /Users/<username> AltSecurityIdentities
  AltSecurityIdentities:
   X509:<T>CN=Apple Root CA,OU=Apple Certification Authority,O=Apple Inc.,C=US<S>CN=com.apple.idms.appleid.prd.00****-**-********-****-****-****-**********e9
  ```
* check account policy

  ```bash
  $ sudo dscl . -read /Users/<username> dsAttrTypeNative:accountPolicyData
  dsAttrTypeNative:accountPolicyData:
   <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
  <dict>
    <key>creationTime</key>
    <real>1730235857.0728331</real>
    <key>failedLoginCount</key>
    <integer>0</integer>
    <key>failedLoginTimestamp</key>
    <integer>0</integer>
    <key>passwordLastSetTime</key>
    <real>1730752335.9585528</real>
  </dict>
  </plist>
  ```

#### list all accounts

> \[!NOTE|label:references:]
>
> * [Delete a standard user from Mac OS](https://apple.stackexchange.com/q/310308/254265)

```bash
$ sudo dscl . -list /Users

# or
$ sudo dscl . -list /Users GeneratedUID

# or
$ sudo dscacheutil -q user
```

> \[!TIP]
>
> * using `diskutil list` to get disk info

![check which user is using the disk](https://1999659500-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHqOSW6on5cHbtwcSH6%2Fsync%2F38181613c90dc93e9f986367d2f0ff2e496e47a7.png?generation=1609332075370511\&alt=media)

#### guest account

**create guest and enable**

> \[!NOTE|label:references:]
>
> * scripts: <https://github.com/sheagcraig/guestAccount/blob/master/guest\\_account>

```bash
$ dscl . -create /Users/Guest

# keychain
$ keychain='/Users/Guest/Library/Keychains/login.keychain'
$ security create-keychain -p '' $keychain
$ security login-keychain -s $keychain
```

#### [enable root user](https://support.apple.com/en-us/HT204012)

![Enable Root User](https://1999659500-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHqOSW6on5cHbtwcSH6%2Fsync%2F5a934f29f09b95f890e80daa57aabb50ac9600e0.png?generation=1609333030508009\&alt=media)

**disable guest account**

```bash
$ sudo dscl . delete /Users/Guest
$ sudo defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool NO
$ sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool NO
$ sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool FALSE

# remove Other
$ sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWOTHERUSERS_MANAGED -bool FALSE
```

* or

  ```bash
  $ sudo /usr/sbin/sysadminctl -deleteUse Guest
  ```
* [check status](https://apple.stackexchange.com/a/402502/254265)

  ```bash
  $ sysadminctl -guestAccount status
  2020-12-30 20:27:59.524 sysadminctl[45327:844298] Guest account disabled.
  $ sudo sysadminctl -guestAccount off
  2020-12-30 20:28:39.645 sysadminctl[45479:846930] Guest account is already disabled
  ```

#### add account

* as admin

  ```bash
  $ sudo sysadminctl -addUser <username> -password <password> -admin
  ```
* as normal user

  ```bash
  $ sysadminctl -addUser <username> -fullName "<full name>" -password "<password>" -hint "<hint>"
  ```

### system tools

#### `hostinfo`

```bash
$ hostinfo
Mach kernel version:
   Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64
Kernel configured for up to 12 processors.
6 processors are physically available.
12 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3 4 5 6 7 8 9 10 11
Primary memory available: 16.00 gigabytes
Default processor set: 463 tasks, 2557 threads, 12 processors
Load average: 2.72, Mach factor: 9.26
```

#### [get human-readable vm\_stat](https://apple.stackexchange.com/a/216657/254265)

```bash
$ paste <(vm_stat | awk 'NR>1' | grep -o ".*:") <(for i in $(vm_stat | awk 'NR>1' | tr -d '.' | awk '{print $NF}'); do perl -e "print $i/1024" | awk '{printf "%0.2f", $0}'; echo; done) | column -s: -t
Pages free                      328.70
Pages active                    910.00
Pages inactive                  973.38
Pages speculative               39.51
Pages throttled                 0.00
Pages wired down                852.52
Pages purgeable                 389.65
"Translation faults"            174323.38
Pages copy-on-write             7828.62
Pages zero filled               127404.04
Pages reactivated               3420.56
Pages purged                    6392.20
File-backed pages               656.69
Anonymous pages                 1266.20
Pages stored in compressor      2536.76
Pages occupied by compressor    991.23
Decompressions                  1555.85
Compressions                    8494.54
Pageins                         7799.75
Pageouts                        11.98
Swapins                         43.15
Swapouts                        48.46
```

#### show system info

```bash
$ glances
```

#### show memory

```bash
$ top -o MEM
```

**iStat**

```bash
 $ istats
--- CPU Stats ---
CPU temp:               53.19°C     ▁▂▃▅▆▇

--- Fan Stats ---
Total fans in system:   2
Fan 0 speed:            2157 RPM    ▁▂▃▅▆▇
Fan 1 speed:            1995 RPM    ▁▂▃▅▆▇

--- Battery Stats ---
Battery health:         unknown
Cycle count:            34          ▁▂▃▅▆▇  3.4%
Max cycles:             1000
Current charge:         6093 mAh    ▁▂▃▅▆▇  100%
Maximum charge:         6237 mAh    ▁▂▃▅▆▇  85.0%
Design capacity:        7336 mAh
Battery temp:           36.5°C

For more stats run `istats extra` and follow the instructions.
```

#### show adapter

```bash
$ pmset -g adapter            # or `pmset -g ac`
 Wattage = 140W
 Current = 4990mA
 Voltage = 28000mV
 AdapterID = 28697
 Manufacturer = Apple Inc.
 Family Code = 0xe000400a
 Serial String = C4H430307PCQ41CA4
 Adapter Name = 140W USB-C Power Adapter
 Hardware Version = 1.0
 Firmware Version = 01040073
```

* show charge status

  ```
  $ pmset -g ps            # or `pmset -g batt`
  Now drawing from 'AC Power'
  -InternalBattery-0 (id=66125923) 100%; charged; 0:00 remaining present: true

  $ pmset -g rawbatt
  12/12/2024 04:06:55
  AC; Not Charging; 100%; Cap=100: FCC=100; Design=8579; Time=0:00; 0mA; Cycles=6/1000; Location=0;
  Polled boot=12/11/2024 17:43:05; Full=12/12/2024 04:03:30; User visible=12/12/2024 04:06:30

  $ system_profiler SPPowerDataType | sed -n '/Charge Information:/,/System Power Settings:/p' | sed '$d'
       Charge Information:
           The battery’s charge is below the warning level: No
           Fully Charged: Yes
           Charging: No
           State of Charge (%): 100
       Health Information:
           Cycle Count: 6
           Condition: Normal
           Maximum Capacity: 100%

  $ system_profiler SPPowerDataType | grep -A11 "AC Charger Information"
     AC Charger Information:

       Connected: Yes
       ID: 0x7019
       Wattage (W): 140
       Family: 0xe000400a
       Serial Number: C4H430307PCQ41CA4
       Name: 140W USB-C Power Adapter
       Manufacturer: Apple Inc.
       Hardware Version: 1.0
       Firmware Version: 1040073
       Charging: No
  ```

#### show Mach virtual memory statistics

```bash
$ vm_stat
```

#### check process without interactive mode

```bash
$ top -l 1 -n 0
```

* example

  ```bash
  $ top -l 1 -n 0
  Processes: 472 total, 3 running, 469 sleeping, 2589 threads
  2020/11/02 16:10:28
  Load Avg: 2.67, 2.88, 3.12
  CPU usage: 33.4% user, 20.46% sys, 46.49% idle
  SharedLibs: 268M resident, 69M data, 44M linkedit.
  MemRegions: 112888 total, 3016M resident, 90M private, 2802M shared.
  PhysMem: 16G used (3742M wired), 420M unused.
  VM: 3201G vsize, 1993M framework vsize, 44188(0) swapins, 49627(0) swapouts.
  Networks: packets: 1575080/1561M in, 1302980/954M out.
  Disks: 1368885/28G read, 648911/13G written.
  ```
* [or](https://apple.stackexchange.com/a/46655/254265)

  ```bash
  $ top -l 1 -s 0
  ```

### show system

#### Serial Number

```bash
$ /usr/sbin/system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro15,1
      Processor Name: 6-Core Intel Core i7
      Processor Speed: 2.2 GHz
      Number of Processors: 1
      Total Number of Cores: 6
      L2 Cache (per Core): 256 KB
      L3 Cache: 9 MB
      Hyper-Threading Technology: Enabled
      Memory: 16 GB
      Boot ROM Version: 10**.***.*.*.* (iBridge: 17.**.*****.*.*,*)
      Serial Number (system): ************
      Hardware UUID: ********-****-****-****-************
      Activation Lock Status: Enabled
```

#### hardware

* cpu manufacture

  ```bash
  # intel cpu
  $ sysctl -n machdep.cpu.brand_string
  Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz

  # apple silicon
  $ sysctl -n machdep.cpu.brand_string
  Apple M3 Pro

  # or
  $ sysctl machdep.cpu
  machdep.cpu.max_basic: 22
  machdep.cpu.max_ext: 2147483656
  machdep.cpu.vendor: GenuineIntel
  machdep.cpu.brand_string: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  machdep.cpu.family: 6
  ...
  # ------
  $ sysctl machdep.cpu
  machdep.cpu.cores_per_package: 12
  machdep.cpu.core_count: 12
  machdep.cpu.logical_per_package: 12
  machdep.cpu.thread_count: 12
  machdep.cpu.brand_string: Apple M3 Pro
  ```

#### memory

```bash
$ system_profiler SPHardwareDataType | grep  "Memory:\|Cores:\|Processors:"
      Number of Processors: 1
      Total Number of Cores: 6
      Memory: 16 GB

# M3
$ system_profiler SPHardwareDataType | grep  "Memory:\|Cores:\|Processors:"
      Total Number of Cores: 12 (6 performance and 6 efficiency)
      Memory: 36 GB
```

* or

  ```bash
  $ sysctl hw.memsize
  hw.memsize: 17179869184

  $ sysctl hw.ncpu
  hw.ncpu: 12
  ```

[**memory slot**](https://apple.stackexchange.com/a/11591/254265)

```bash
$ system_profiler SPMemoryDataType
Memory:

    Memory Slots:

      ECC: Disabled
      Upgradeable Memory: No

        BANK 0/ChannelA-DIMM0:

          Size: 8 GB
          Type: DDR4
          Speed: 2400 MHz
          Status: OK
          Manufacturer: Micron
          Part Number: **********-*****
          Serial Number: -

        BANK 2/ChannelB-DIMM0:

          Size: 8 GB
          Type: DDR4
          Speed: 2400 MHz
          Status: OK
          Manufacturer: Micron
          Part Number: **********-*****
          Serial Number:

# -- M3 --
$ system_profiler SPMemoryDataType
Memory:

      Memory: 36 GB
      Type: LPDDR5
      Manufacturer: Micron
```

#### [swap usage](https://apple.stackexchange.com/a/110459/254265)

```bash
$ sysctl vm.swapusage
vm.swapusage: total = 1024.00M  used = 34.00M  free = 990.00M  (encrypted)
```

#### [show kernel version](https://apple.stackexchange.com/a/368722/254265)

```bash
# -- i7 --
$ sysctl kern.version
kern.version: Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64
# -- M3 --
$ sysctl kern.version
kern.version: Darwin Kernel Version 23.6.0: Thu Dec 19 20:47:53 PST 2024; root:xnu-10063.141.1.703.2~1/RELEASE_ARM64_T6030

$ sysctl kern.ostype
kern.ostype: Darwin

$ sysctl kern.osrelease
kern.osrelease: 20.1.0

$ sysctl kern.osrevision
kern.osrevision: 199506
```

* or

  ```bash
  $ uname -a
  Darwin iMarslo 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64 x86_64 i386 MacBookPro15,1 Darwin

  # -- kern.version --
  $ uname -v
  Darwin Kernel Version 23.6.0: Thu Dec 19 20:47:53 PST 2024; root:xnu-10063.141.1.703.2~1/RELEASE_ARM64_T6030

  # -- kern.ostype --
  $ uname -s
  Darwin
  ```

#### show resolution

```bash
$ system_profiler SPDisplaysDataType | awk '/Resolution:/ {print $2"x"$4}'
3456x2234
```

#### [list printer status](https://unix.stackexchange.com/q/140009/29178)

```bash
$ lpstat -a
printer-01 accepting requests since Wed Feb  3 16:40:50 2021
```

#### plist file

* read file

  ```bash
  $ plutil -p /path/to/file.plist
  # i.e.:
  $ plutil -p /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist

  $ /usr/libexec/PlistBuddy -c print /path/to/file.plist
  # i.e.:
  $ /usr/libexec/PlistBuddy -c print /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist
  ```

### osx installation

#### [download older version](https://512pixels.net/2019/10/download-macos-installers-with-terminal/)

{% hint style="info" %}
[How to Download Full MacOS Installers from Command Line](https://osxdaily.com/2020/04/13/how-download-full-macos-installer-terminal/)
{% endhint %}

```bash
$ softwareupdate --fetch-full-installer
```

* or

  ```bash
  $ softwareupdate --fetch-full-installer --full-installer-version **.**.*

  # i.e.:
  $ softwareupdate --fetch-full-installer --full-installer-version 10.15
  ```
* MacOS Mojave 10.14.6 Installer

  ```bash
  $ softwareupdate --fetch-full-installer --full-installer-version 10.14.6
  ```
* MacOS Catalina 10.15.3 Installer

  ```bash
  $ softwareupdate --fetch-full-installer --full-installer-version 10.15.3
  ```
* MacOS High Sierra 10.13.6 Installer

  ```bash
  $ softwareupdate --fetch-full-installer --full-installer-version 10.13.6
  ```

#### [create osx installer usb](https://osxdaily.com/2019/06/06/make-macos-catalina-beta-usb-boot-install-drive/)

* for Catalina FINAL version

  ```bash
  $ sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/UNTITLED && echo Catalina Boot Drive Created
  ```
* for Catalina BETA version

  ```bash
  $ sudo /Applications/Install\ macOS\ Catalina\ Beta.app/Contents/Resources/createinstallmedia --volume /Volumes/UNTITLED && echo Catalina Boot Drive Created
  ```

#### boot with macOS USB installer

* connect the macOS Catalina 10.15 beta install drive to to the Mac you want to install Catalina onto
* reboot the Mac
* immediately hold down the OPTION key upon boot, keep holding Option until you see the boot menu
* choose the macOS Catalina 10.15 beta installer volume to boot from

#### [Convert a MacOS Installer to ISO](https://osxdaily.com/2020/07/20/how-convert-macos-installer-iso/)

* download [MacOS Mojave installer](https://itunes.apple.com/us/app/macos-mojave/id1398502828?mt=12), or the [MacOS Catalina installer](https://itunes.apple.com/us/app/macos-catalina/id1466841314?ls=1\&mt=12) (or the installer you wish to turn into an ISO) from the Mac App Store, untill the “Install MacOS Mojave.app” or “Install MacOS Catalina.app” application is fully downloaded and within the /Applications folder, proceed
* open the Terminal application, create a disk image DMG file via:

```bash
$ hdiutil create -o /tmp/Mojave -size 8500m -volname Mojave -layout SPUD -fs HFS+J
```

* mount the created DMG disk image via:

```bash
$ hdiutil attach /tmp/Mojave.dmg -noverify -mountpoint /Volumes/Mojave
```

* use createinstallmedia to create the macOS installer application on the mounted volume:

```bash
$ sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/Mojave --nointeraction
```

* unmount the volume just created:

```bash
$ hdiutil detach /volumes/Install\ macOS\ Mojave
```

* convert the DMG disk image file to an ISO disk image file (technically a CDR file but it’s the same as an iso)

```bash
$ hdiutil convert /tmp/Mojave.dmg -format UDTO -o ~/Desktop/Mojave.cdr
```

* rename the CDR file extension to ISO to convert the CDR to ISO:

```bash
$ mv ~/Desktop/Mojave.cdr ~/Desktop/Mojave.iso
```

{% hint style="success" %}
more info: [Convert ISO to VDI Virtual Box Image](https://osxdaily.com/2018/06/17/convert-iso-to-vdi-virtualbox-image/)
{% endhint %}

### flushed

> \[!NOTE|label:references:]
>
> * [How to safely clear cache on Mac](https://setapp.com/how-to/clear-cache-on-mac)

#### disk cache

```bash
$ sudo purge
```

#### flush DNS

> \[!NOTE|label:references:]
>
> * [How to safely clear cache on Mac](https://setapp.com/how-to/clear-cache-on-mac)
> * [How to Flush DNS](https://blog.hubspot.com/website/flush-dns)

| VERSION            | COMMAND                                                         |
| ------------------ | --------------------------------------------------------------- |
| macOS 10.10+       | `sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder` |
| macOS 10.7 \~ 10.9 | `sudo killall -HUP mDNSResponder`                               |
| macOS 10.6         | `sudo dscacheutil -flushcache`                                  |
| macOS 10.5-        | `lookupd -flushcache` ( deprecated )                            |

```bash
$ sudo killall -HUP mDNSResponder
# or
$ sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say cache flushed
```

* ventura & monterey

  ```bash
  $ sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  ```
* lion, mountain lion, mavericks, el capitan, sierra, high sierra, mojave

  ```bash
  $ sudo killall -HUP mDNSResponder
  ```
* yosemite

  ```bash
  $ sudo discoveryutil mdnsflushcache
  ```
* tiger

  ```bash
  $ lookupd -flushcache
  ```

### clean OSX native dot file

```bash
$ dot_clean -mvp <path>
```

* i.e.:

  ```bash
  $ sudo dot_clean -mvp /
  ```
* or

  ```bash
  $ /usr/local/bin/rg --hidden --smart-case --color=never --files "$HOME" -g '*\.DS_*' | xargs -r rm
  # or
  $ /usr/local/bin/fd -Iu --glob '*\.DS_*' $HOME | xargs -r rm

  $ find $HOME -name '.DS_Store' -type f -delete
  # or
  $ find / -name '._*' -type f -delete
  # or
  $ find / -name '._*' -type f -size -4k -delete
  ```
* or [disable indexing](https://apple.stackexchange.com/a/39751/254265)

  ```bash
  $ sudo mdutil -i off /Volumes/<diskName>
  ```
* or all-in-all actions

  > \[!NOTE|label:references:]
  >
  > * [\* iMarslo: defaults: disable the `.DS_Store` and `._*`](https://github.com/marslo/ibook/blob/marslo/docs/osx/defaults.html#disable-the-ds_store-and-_)

  ```bash
  $ sudo defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
  $ sudo mdutil -i off /Volumes/<FS NAME>
  $ sudo rm -rf .{DS_Store,fseventsd,Spotlight-V*,Trashes}
  ```
* for windows

  ```batch
  > cd c:\path\to\folder
  > del /s /q /f /a .DS_STORE
  > del /s /q /f /a:h ._*
  ```
* flush DNS

  ```bash
  $ ipconfig /flushdns
  ```

### launchctl

#### create new plist

```bash
$ cat > ~/Library/LaunchAgents/i.marslo.updatedb.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>i.marslo.updatedb</string>
  <key>ProgramArguments</key>
  <array>
    <string>sudo</string>
    <string>/usr/local/bin/gupdatedb</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>StandardErrorPath</key>
  <string>/Users/marslo/.marslo/log/i.marslo.updatedb.log</string>
  <key>StandardOutPath</key>
  <string>/Users/marslo/.marslo/log/i.marslo.updatedb.error.log</string>
  <key>StartInterval</key>
  <integer>300</integer>
  <key>KeepAlive</key>
  <true/>
</dict>
</plist>
EOF
```

* check

  ```bash
  $ plutil ~/Library/LaunchAgents/i.marslo.updatedb.plist
  /Users/marslo/Library/LaunchAgents/i.marslo.updatedb.plist: OK
  ```
* enable

  ```bash
  $ launchctl load ~/Library/LaunchAgents/i.marslo.updatedb.plist
  $ launchctl list | grep updatedb
  - 1 i.marslo.updatedb
  ```
* disable

  ```bash
  $ launchctl remove i.marslo.updatedb
  ```

### printer

#### Xerox WorkCentre 7545

1. download driver in <https://www.support.xerox.com>
2. go to [`Drivers & Downloads - WorkCentre 7525/7530/7535/7545/7556`](https://www.support.xerox.com/en-us/product/workcentre-7545-7556/downloads)

![Xerox WorkCentre 7545](https://1999659500-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHqOSW6on5cHbtwcSH6%2Fuploads%2Fgit-blob-f84a6ad7c447763db0a6aa221997655008309ae6%2F7545-driver-1.png?alt=media)

3. filter by MacOS version, and download `macOS Print and Scan Driver Installer` ( [XeroxDrivers\_5.16.0\_2486.dmg](https://download.support.xerox.com/pub/drivers/ALB80XX/drivers/macOS12/pt_BR/XeroxDrivers_5.16.0_2486.dmg) )

```bash
$ curl -fsSL -O https://download.support.xerox.com/pub/drivers/ALB80XX/drivers/macOS12/pt_BR/XeroxDrivers_5.16.0_2486.dmg
```

![Xerox WorkCentre 7545](https://1999659500-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHqOSW6on5cHbtwcSH6%2Fuploads%2Fgit-blob-6f13839786170238b2be48f7a3ca4aba7ea0da3f%2F7545-driver-2.png?alt=media)

#### Xerox VersaLink C7130 Multifunction Printer

1. search `VersaLink C7130` in driver page <https://www.support.xerox.com>
2. go to [`Drivers & Downloads - VersaLink C7120/C7125/C7130 Color Multifunction Printer`](https://www.support.xerox.com/en-us/product/versalink-c7100-series/downloads?language=en)

![Xerox VersaLink C7130](https://1999659500-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHqOSW6on5cHbtwcSH6%2Fuploads%2Fgit-blob-d34b160d8ff0d3c40a2284a22021831f18e39acd%2Fc7130-driver-1.png?alt=media)

3. filter by MacOS version, and download `macOS Print and Scan Driver Installer` ( [XeroxDrivers\_5.16.0\_2486.dmg](https://download.support.xerox.com/pub/drivers/ALB80XX/drivers/macOS12/pt_BR/XeroxDrivers_5.16.0_2486.dmg) )

```bash
$ curl -fsSL -O https://download.support.xerox.com/pub/drivers/ALB80XX/drivers/macOS12/pt_BR/XeroxDrivers_5.16.0_2486.dmg
```

![Xerox VersaLink C7130](https://1999659500-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHqOSW6on5cHbtwcSH6%2Fuploads%2Fgit-blob-c120193b27d33fcfeac7980148ba3f43bb83f0ca%2Fc7130-driver-2.png?alt=media)

### profiles

#### prints all configuration profiles

```bash
$ sudo profiles -P
```

#### show expanded information for profiles

```bash
$ sudo profiles show
# or
$ sudo profiles show -type configuration
```

#### shwo device enrollment configuration

```bash
$ sudo profiles show -type enrollment
```

### log

#### check log stream

```bash
$ sudo log stream
# or
$ sudo log stream --predicate 'eventMessage contains "error"' --info

# last 5 mins
$ sudo log show --style syslog --predicate 'eventMessage contains "account"' --last 5m

# check appstore ~= `tail -f | grep`
$ log stream --predicate 'eventMessage contains "account" OR eventMessage contains "store" OR senderImagePath contains "appstore"' --info
```

### Q\&A

#### `SUPreferenceManager: Failed to set object of class: __NSCFString`

* issue:

  ```bash
  $ softwareupdate --fetch-full-installer
  Downloading and installing com.apple.InstallAssistant.macOSBigSur installer
  SUPreferenceManager: Failed to set object of class: __NSCFString for key: LastRecommendedMajorOSBundleIdentifier with error: Error Domain=SUPreferenceManagerErrorDomain Code=1 "(null)"
  SUPreferenceManager: Failed to set object of class: __NSCFString for key: LastRecommendedMajorOSBundleIdentifier with error: Error Domain=SUPreferenceManagerErrorDomain Code=1 "(null)"
  SUPreferenceManager: Failed to set object of class: __NSCFString for key: LastRecommendedMajorOSBundleIdentifier with error: Error Domain=SUPreferenceManagerErrorDomain Code=1 "(null)"
  Installing: 90.0%SUPreferenceManager: Failed to set object of class: __NSCFString for key: LastRecommendedMajorOSBundleIdentifier with error: Error Domain=SUPreferenceManagerErrorDomain Code=1 "(null)"
  Install failed with error: 0
  ```
