Home / Notes / General MacOSX Notes
===================================

 1. Creating a Ram Disk

    a. Create and mount the ramdisk:

        $ hdid -nomount ram://[size]
        /dev/disk[X]

        [size] should be 2 * 1024 * desired size of the RAM disk in MB
        [X] will be the disk number for the ramdisk that hdid allocated.

    b. Format the ramdisk for HFS+:

        $ diskutil eraseDisk HFS+ RAMDISK disk[X]

    c. Eject the disk when you are finished using it:

        $ hdiutil detach /dev/disk[X]

 2. Changing Shells (outdated)

    $ sudo niutil -createprop / /Users/[username] shell [shell]

    [username] is your short username
    [shell] is the full path to the new shell

 3. MacOS X X11 Options (outdated)

    a. Map Option to META:

        $ defaults write com.apple.x11 swap_alt_meta -bool true

    b. Disable X11 Server from listening for remote connections:

        $ defaults write com.apple.x11 nolisten_tcp -boolean true

 4. Change the Screenshot Type

    $ defaults write com.apple.screencapture type [type]

    [type] is either pdf, png, jpg or gif

 5. Disable .DSStore files on Network Volumes

    $ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

 6. Disable AFP Guest Access

    $ defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool false

 7. Disable iCloud Saving

    $ defaults write -g NSDocumentSaveNewDocumentsToCloud -bool false

 8. Disable / Enable Dashboard

    $ defaults write com.apple.dashboard mcx-disabled -boolean YES && killall Dock
    $ defaults write com.apple.dashboard mcx-disabled -boolean NO && killall Dock

 9. Disable in-app rating and reviews:

    $ defaults write com.apple.appstore InAppReviewEnabled -bool false

    From: Disabling in-app review requests for apps installed from the macOS App Store,
    Der Flounder (July 20, 2023)

10. Get MacOSX Version Info

    a. System Version:

        $ defaults read loginwindow SystemVersionStampAsString

        or

        $ sw_vers -productVersion

    b. Build Version:

        $ defaults read loginwindow BuildVersionStampAsString

        or

        $ sw_vers -buildVersion

11. List Kernel Extensions

    a. Before Big Sur (11.x): $ kextstat -l

    b. Big Sur (11.x) and newer: $ kmutil showloaded

    From: Lloyd Chambers, macOS Big Sur: how to List Active Kernel Extensions,
          MacPerformance Guide (May 11, 2021).

12. Restore classic alerts Big Sur (11.x) and Monterey (12.x)

    $ defaults write -g NSAlertMetricsGatheringEnabled -bool false

    From: Michael Tsai, Wider Alerts on Monterey and Big Sur (Apr. 1, 2022).

13. Restart stuck software updates on Big Sur (11.x) and newer

    $ sudo launchctl kickstart -k system/com.apple.softwareupdated

    From: https://community.jamf.com/t5/jamf-pro/big-sur-11-6-x-software-update-hangs/m-p/257525#M238472.

14. Enable/disable low power mode on Monterey (12.x)

    $ sudo pmset -a lowpowermode 1
    $ sudo pmset -a lowpowermode 0

    From: https://osxdaily.com/2022/03/30/enable-low-power-mode-mac-command-line/.

15. Enable/disable password to wake from sleep / hibernate

    $ sudo pmset -a DestroyFVKeyOnStandby 1
    $ sudo pmset -a DestroyFVKeyOnStandby 0

    From: https://eclecticlight.co/2017/01/20/power-management-in-detail-using-pmset/.

16. Reset the DNS cache on Monterey (12.x)

    $ sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

    From: https://osxdaily.com/2022/11/21/how-clear-dns-cache-macos-ventura-monterey/

17. Converting a Samsung T7 to APFS

    My Samsung T7 came formatted as EXFAT, and DiskUtility.app would not
    allow it to be formatted as APFS with encryption.  To covert the
    disk to APFS, I did the following:

    1. Partition to disk as GPT with a Journaled HFS+ partition:

       $ diskutil partitionDisk disk[#] GPT JHFS+ "T7" 0g

       Replace # with the disk number shown by 'diskutil list'

    2. In DiskUtility.app, select the disk named "T7" and partition it
       a APFS encrypted