[!TIP|label:reference]

system information

get osx info

$ sw_vers
ProductName:  Mac OS X
ProductVersion: 10.15.6
BuildVersion: 19G73

# or
$ sw_vers --productName
macOS
$ sw_vers --productVersion
14.4.1

$ /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: 1037.147.1.0.0 (iBridge: 17.16.16065.0.0,0)
      Serial Number (system): C02XFGWEJG5H
      Hardware UUID: 4EA008BF-9B36-5F1D-9151-AD4F64808AAB
      Activation Lock Status: Enabled
system-info
1.2.3.1 -- system-info

get CPU information

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

# 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
...

get more details

$ sysctl -a

reboot if system freezes

$ sudo systemsetup -setrestartfreeze on

setup hostname and localhostname

$ sudo scutil --set HostName [HOSTNAME]
$ sudo scutil --set LocalHostName [HOSTNAME]
$ sudo scutil --set ComputerName [HOSTNAME]             # Optional
$ dscacheutil -flushcache                               # Flush the DNS Cache
$ sudo shutdown -r now

setup bash as default SHELL

$ chsh -s /bin/bash
# OR
$ chsh -s `which bash`

disable guest user

$ 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

go to hidden path in finder

Command+Shift+G

reindex spotlight

$ sudo mdutil -i on /
$ sudo mdutil -E /
$ sudo mdutil -E /Volumes/marslo/
  • or
    $ sudo mdutil -i off /
    $ sudo rm -rf /.Spotlight-V100
    $ sudo rm -rf /.Spotlight-V200
    $ sudo mdutil -i on /
    $ sudo mdutil -E /
    $ sudo mdutil -E /Volumes/marslo/
    

copy STDOUT into clipboard

refer to: osx/tricky

Copy path from finder

refer to: osx/tricky

System Integrity Protection

refer to: osx/tricky

change Mac default settings

refer to: osx/defaults

development environment

setup JAVA_HOME

$ /usr/libexec/java_home -v 1.8.0.162 -exec javac -versioin

xCode

refer to osx

xCode installation

xCode setup

$ sudo xcodebuild -license [accept]

xCode commandline tools

  • verify installed or not

    $ xcode-select -p
    
  • xCode commandline tools installation

    $ xcode-select --install
    xcode-select: note: install requested for command line developer tools
    
  • upgrade commandline tools

    $ softwareupdate --all --install --force
    
    • or
      $ sudo rm -rf /Library/Developer/CommandLineTools
      $ sudo xcode-select --install
      
  • list history `bash $ softwareupdate --history

xcode components installation

$ for pkg in /Applications/Xcode.app/Contents/Resources/Packages/*.pkg; do
>   sudo installer -pkg "$pkg" -target /;
> done
  • example:

    $ ls -altrh /Applications/Xcode.app/Contents/Resources/Packages/
    total 180512
    -rw-r--r--   1 root  wheel    87K Mar 10  2017 MobileDeviceDevelopment.pkg
    -rw-r--r--   1 root  wheel   5.4M Sep 30 05:28 XcodeSystemResources.pkg
    -rw-r--r--   1 root  wheel    11K Sep 30 05:28 XcodeExtensionSupport.pkg
    -rw-r--r--   1 root  wheel    83M Sep 30 05:28 MobileDevice.pkg
    drwxr-xr-x   6 root  wheel   204B Oct 11 05:23 ./
    drwxr-xr-x  87 root  wheel   2.9K Oct 11 05:55 ../
    
    $ for pkg in /Applications/Xcode.app/Contents/Resources/Packages/*.pkg; do
     -> sudo installer -pkg "$pkg" -target /;
     -> done
    installer: Package name is MobileDevice
    installer: Upgrading at base path /
    installer: The upgrade was successful.
    installer: Package name is MobileDeviceDevelopment
    installer: Installing at base path /
    installer: The install was successful.
    installer: Package name is XcodeExtensionSupport
    installer: Installing at base path /
    installer: The install was successful.
    installer: Package name is XcodeSystemResources
    installer: Installing at base path /
    installer: The install was successful.
    

enable developer mode

$ DevToolsSecurity -enable

show sdk path

[!NOTE|label:more:]

$ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Homebrew

refer to: osx/apps.html

system settings

refer to: osx/apps

accessory

refer to: osx/apps

q&a

x86_64 liblzma.dylib in nokogiri

  • solution 1:

    $ brew unlink xz
    $ gem install nokogiri # or gem install cupertino
    $ brew link xz
    
  • solutioin 2 (using system libraies):

    $ brew install libxml2
    $ gem install nokogiri -- --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2
    
    # or
    $ bundle config build.nokogiri --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2
    $ bundle install
    
    # or
    $ brew link --force libxml2
    $ gem install nokogiri -v '1.7.0.1'  -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib
    

tips

system tool upgrade

cmd

$ /usr/sbin/softwareupdate --all --install --force

# list history
$ /usr/sbin/softwareupdate --history
  • settings

    $ tail /private/var/log/install.log
    ...
    2024-12-13 00:55:45-08 HNWH3C04CX softwareupdated[572]: SUOSUMobileSoftwareUpdateController: Updating additionalUpdateMetricEventFields: {
          autoUpdate = false;
          buddy = false;
          commandLine = true;
          installTonight = false;
          mdm = false;
          notification = false;
          settings = false;
      }
    ...
    
  • install/uninstall package

    • *.pkg
      $ sudo installer -pkg /path/to/package.pkg -target /
      $ sudo installer -pkg /path/to/package.pkg -target / -uninstall
      

process

  • trustd

    $ ps aux | grep trustd
    marslo             836  10.7  0.1 410449040  22240   ??  S    Thu12PM  11:20.83 /usr/libexec/trustd --agent
    _trustd            414   5.4  0.1 410447680  23744   ??  Ss   Thu12PM  22:51.11 /usr/libexec/trustd
    _spotlight        1768   0.0  0.0 410389120  14144   ??  S    Thu12PM   0:07.70 /usr/libexec/trustd --agent
    _accessoryupdater   677   0.0  0.0 410380144   5728   ??  S    Thu12PM   0:00.93 /usr/libexec/trustd --agent
    _cmiodalassistants   615   0.0  0.0 410380128   5840   ??  S    Thu12PM   0:00.88 /usr/libexec/trustd --agent
    _locationd         570   0.0  0.0 410380144   5872   ??  S    Thu12PM   0:00.87 /usr/libexec/trustd --agent
    marslo           20127   0.0  0.0 410593776   1232 s001  S+   11:31AM   0:00.00 grep -i --color=always trustd
    root               423   0.0  0.0 410346128   3744   ??  Ss   Thu12PM   0:00.04 /usr/libexec/trustdFileHelper
    
  • accountd

    $ ps aux | grep account
    marslo           34564   0.0  0.0 411096384  12752   ??  Ss   Thu09PM   0:00.12 /System/Library/PrivateFrameworks/RemoteManagement.framework/XPCServices/AccountSubscriber.xpc/Contents/MacOS/AccountSubscriber
    marslo            2037   0.0  0.0 410400912  18096   ??  S    Thu12PM   0:00.61 /usr/libexec/appleaccountd
    _rmd              2032   0.0  0.0 410902768   9696   ??  Ss   Thu12PM   0:00.06 /System/Library/PrivateFrameworks/RemoteManagement.framework/XPCServices/AccountSubscriber.xpc/Contents/MacOS/AccountSubscriber
    root              1442   0.0  0.0 410993328  14272   ??  Ss   Thu12PM   0:08.17 /private/var/db/com.apple.xpc.roleaccountd.staging/exec/16777229.34120.xpc/Contents/MacOS/com.apple.NRD.UpdateBrainService
    root              1443   0.0  0.0 410378000   4240   ??  Ss   Thu12PM   0:00.06 /usr/libexec/xpcroleaccountd -launchd
    marslo             977   0.0  0.1 410442688  19280   ??  S    Thu12PM   0:14.47 /System/Library/PrivateFrameworks/AppleMediaServices.framework/Resources/amsaccountsd
    marslo             817   0.0  0.2 410643792  82720   ??  S    Thu12PM   1:41.97 /System/Library/Frameworks/Accounts.framework/Versions/A/Support/accountsd
    root               601   0.0  0.0 410400864   3984   ??  Ss   Thu12PM   0:00.05 /System/Library/PrivateFrameworks/AccountPolicy.framework/XPCServices/com.apple.AccountPolicyHelper.xpc/Contents/MacOS/com.apple.AccountPolicyHelper
    marslo           13632   0.0  0.0 410433248  12704   ??  S    11:14AM   0:00.11 /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Resources/storeaccountd
    
  • installd

    $ ps aux | grep installd
    root              1165  92.5  1.8 411273744 668928   ??  Rs   Thu12PM   8:45.34 /System/Library/PrivateFrameworks/PackageKit.framework/Resources/installd
    root              1166   0.0  0.0 410387200  10016   ??  Ss   Thu12PM   0:02.80 /System/Library/PrivateFrameworks/PackageKit.framework/Resources/system_installd
    root               584   0.0  0.0 410360448   6624   ??  Ss   Thu12PM   0:00.04 /usr/libexec/bootinstalld
    root               413   0.0  0.0 411112672   3920   ??  Ss   Thu12PM   0:00.19 /usr/libexec/containermanagerd_system --runmode=privileged --user-container-mode=current --bundle-container-mode=global --bundle-container-owner=_appinstalld --system-container-mode=none
    root               311   0.0  0.0 410189360   4384   ??  Ss   Thu12PM   0:14.45 /System/Library/PrivateFrameworks/Uninstall.framework/Resources/uninstalld
    

GUI

  • Software Update

    $ open "/System/Library/CoreServices/Software Update.app"
    $ open "/System/Library/CoreServices/Software Update.app/Contents/Resources/softwareupdated"
    
  • SoftwareUpdateNotificationManager

    $ open /System/Library/PrivateFrameworks/SoftwareUpdate.framework/Versions/A/Resources/SoftwareUpdateNotificationManager.app
    $ open /System/Library/PrivateFrameworks/SoftwareUpdate.framework/Versions/A/Resources/SoftwareUpdateNotificationManager.app/Contents/MacOS/SoftwareUpdateNotificationManager
    
  • patch

    • 14.7.2: https://swscan.apple.com/content/catalogs/others/index-14-13-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz
Copyright © marslo 2020-2024 all right reserved,powered by GitbookLast Modified: 2024-12-16 11:32:44

results matching ""

    No results matching ""