# add "ViewModel" and "View"$defaultswritecom.apple.dt.Xcode"IDEAdditionalCounterpartSuffixes"-array-add"ViewModel""View"&&killallXcode# add "Router", "Interactor" and "Builder"$defaultswritecom.apple.dt.Xcode"IDEAdditionalCounterpartSuffixes"-array-add"Router""Interactor""Builder"&&killallXcode
$osascript<<EODtell application "Terminal" local allOpenedWindows local initialOpenedWindows local windowID set themeName to "Solarized Dark xterm-256color" (* Store the IDs of all the open terminal windows. *) set initialOpenedWindows to id of every window (* Open the custom theme so that it gets added to the list of available terminal themes (note: this will open two additional terminal windows). *) do shell script "open '$HOME/init/" & themeName & ".terminal'" (* Wait a little bit to ensure that the custom theme is added. *) delay 1 (* Set the custom theme as the default terminal theme. *) set default settings to settings set themeName (* Get the IDs of all the currently opened terminal windows. *) set allOpenedWindows to id of every window repeat with windowID in allOpenedWindows (* Close the additional windows that were opened in order to add the custom theme to the list of terminal themes. *) if initialOpenedWindows does not contain windowID then close (every window whose id is windowID) (* Change the theme for the initial opened terminal windows to remove the need to close them in order for the custom theme to be applied. *) else set current settings of tabs of (every window whose id is windowID) to settings set themeName end if end repeatend tellEOD
# old version$sudospctl--master-disable# new version$sudospctl--global-disableGloballydisablingtheassessmentsystemneedstobeconfirmedinSystemSettings# disable quarantine$defaultswritecom.apple.LaunchServicesLSQuarantine-boolfalse$/usr/bin/xattr-c/path/to/app# or$/usr/bin/xattr-dcom.apple.quarantine/path/to/app
.DS_Store – The name of a file in the Apple OS X operating system for storing custom attributes of a folder such as the position of icons or the choice of a background image (Read more)
.Spotlight-V100 – This file holds information to speed up the 'Spotlight Search' feature. Deleting would simply force this information to be re-indexed if you performed another Spotlight Search for an item in this folder.
.apDisk – This file holds information about shared folders and can be safely removed as it will be automatically re-created if Apple needs it.
.VolumeIcon.icns – This file is used to store the icon of the volume (USB device) if the volume uses a custom icon and not the default icon. If you want the device to continue using this default icon, or if the folder/device you want to clean contains an application, you might want to keep this file in your system. As a side note, if you wanted to create a custom icon for your device you could create/download an .icns file and rename it .VolumeIcon.icns and place in your folder/device.
.fseventsd – This file is used as a buffer for the File System Events daemon. If you are using a program that is monitoring this folder/device, this file might be used to store temporary data.
.Trash & .Trashes – These folders are used to hold deleted items the same way that the 'Trash' icon from the dock works. If you don't need this feature on your folder/device, you can clean this folder to save space.
.TemporaryItems – This file is used by the OS to hold temporary data when files are being copied/moved/appended. If you are running any programs that are accessing the folder/device you want to clean, and you aren't copying or moving any files, then this file can simply hold old data for caching.
# network drives$defaultswritecom.apple.desktopservicesDSDontWriteNetworkStores-booltrue# usb drives$defaultswritecom.apple.desktopservicesDSDontWriteUSBStores-booltrue# enable$defaultswritecom.apple.desktopservicesDSDontWriteNetworkStores-boolfalse$defaultswritecom.apple.desktopservicesDSDontWriteUSBStores-boolfalse
$defaultswritecom.apple.finder"_FXSortFoldersFirst"-bool"true"&&killallFinder# for desktop$defaultswritecom.apple.finder"_FXSortFoldersFirstOnDesktop"-bool"true"&&killallFinder
# expand save panel by default$defaultswriteNSGlobalDomainNSNavPanelExpandedStateForSaveMode-booltrue$defaultswriteNSGlobalDomainNSNavPanelExpandedStateForSaveMode2-booltrue# expand print panel by default$defaultswriteNSGlobalDomainPMPrintingExpandedStateForPrint-booltrue$defaultswriteNSGlobalDomainPMPrintingExpandedStateForPrint2-booltrue
# quit printer app once the print jobs complete$defaultswritecom.apple.print.PrintingPrefs"Quit When Finished"-booltrue
save to disk or iCloud
# yes: save to iCloud$defaultswriteNSGlobalDomainNSDocumentSaveNewDocumentsToCloud-booltrue# no: save to disk by default$defaultswriteNSGlobalDomainNSDocumentSaveNewDocumentsToCloud-boolfalse
# enable spring loading$defaultswriteNSGlobalDomaincom.apple.springing.enabled-booltrue# disable spring loading delaydefaultswriteNSGlobalDomaincom.apple.springing.delay-float0
volume mounted
# open finder automatically$defaultswritecom.apple.frameworks.diskimagesauto-open-ro-root-booltrue$defaultswritecom.apple.frameworks.diskimagesauto-open-rw-root-booltrue$defaultswritecom.apple.finderOpenWindowForNewRemovableDisk-booltrue
desktop
show wallpaper location
# show$defaultswritecom.apple.dockdesktop-picture-show-debug-text-booltrue# not show$defaultsdeletecom.apple.dockdesktop-picture-show-debug-text
# show indicators lights$defaultswritecom.apple.dockshow-process-indicators-booltrue
mission control
rearrange automatically
# base on most of recent use$defaultswritecom.apple.dockmru-spaces-booltrue&&killallDock# keep space arrangement$defaultswritecom.apple.dockmru-spaces-boolfalse&&killallDock
# disable on trackpads$defaultswritecom.google.ChromeAppleEnableSwipeNavigateWithScrolls-boolfalse$defaultswritecom.google.Chrome.canaryAppleEnableSwipeNavigateWithScrolls-boolfalse# disable on magic mouse$defaultswritecom.google.ChromeAppleEnableMouseSwipeNavigateWithScrolls-boolfalse$defaultswritecom.google.Chrome.canaryAppleEnableMouseSwipeNavigateWithScrolls-boolfalse
# develop menu and the web inspector$defaultswritecom.apple.SafariIncludeDevelopMenu-booltrue$defaultswritecom.apple.SafariWebKitDeveloperExtrasEnabledPreferenceKey-booltrue$defaultswritecom.apple.Safari"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled"-booltrue# context menu for web inspector$defaultswriteNSGlobalDomainWebKitDeveloperExtras-booltrue
search banners
# search banners default to Contains instead of Starts With$defaultswritecom.apple.SafariFindOnPageMatchesWordStartsOnly-boolfalse
# bottom left - desktop$defaultswritecom.apple.dockwvous-bl-corner-int4&&killallDock# bottom right - application windows$defaultswritecom.apple.dockwvous-br-corner-int3&&killallDock# top right - mission control$defaultswritecom.apple.dockwvous-tr-corner-int2&&killallDock# current settings$defaultsreadcom.apple.dock|grepcorner"wvous-bl-corner"=4;"wvous-br-corner"=3;"wvous-tr-corner"=2;# or$defaultsreadcom.apple.dock|grepcorner|sed-n-E's/ "(.+)" = (.+);/\1=\2/p'wvous-bl-corner=4wvous-br-corner=3wvous-tr-corner=2
# get current status$defaults-currentHostread-globalDomainNSStatusItemSpacing$defaults-currentHostread-globalDomainNSStatusItemSelectionPadding# setup spacing$defaults-currentHostwrite-globalDomainNSStatusItemSpacing-int12$defaults-currentHostwrite-globalDomainNSStatusItemSelectionPadding-int8$killallSystemUIServer# revert$defaults-currentHostdelete-globalDomainNSStatusItemSpacing$defaults-currentHostdelete-globalDomainNSStatusItemSelectionPadding$killallSystemUIServer
# plain text mode$defaultswritecom.apple.TextEditRichText-int0# revert$defaultsdeletecom.apple.TextEditRichText# UTF-8 in TextEdit$defaultswritecom.apple.TextEditPlainTextEncoding-int4$defaultswritecom.apple.TextEditPlainTextEncodingForWrite-int4
# enable auto show subtitles$defaultswritecom.apple.QuickTimePlayerXMGEnableCCAndSubtitlesOnOpen-booltrue# disable auto show subtitles$defaultsdeletecom.apple.QuickTimePlayerXMGEnableCCAndSubtitlesOnOpen
App Store
# enable the webkit developer tools$defaultswritecom.apple.appstoreWebKitDeveloperExtras-booltrue# enable debug menu$defaultswritecom.apple.appstoreShowDebugMenu-booltrue# enable the automatic update check$defaultswritecom.apple.SoftwareUpdateAutomaticCheckEnabled-booltrue# check for software updates daily instead of weekly$defaultswritecom.apple.SoftwareUpdateScheduleFrequency-int1# download newly available updates in background$defaultswritecom.apple.SoftwareUpdateAutomaticDownload-int1# install system data files & security updates$defaultswritecom.apple.SoftwareUpdateCriticalUpdateInstall-int1# automatically download apps purchased on other macs$defaultswritecom.apple.SoftwareUpdateConfigDataInstall-int1# turn on app auto-update$defaultswritecom.apple.commerceAutoUpdate-booltrue# allow the app store to reboot machine on macos updates$defaultswritecom.apple.commerceAutoUpdateRestartRequired-booltrue
activity monitor
# show main window$defaultswritecom.apple.ActivityMonitorOpenMainWindow-booltrue# visualize cpu usage$defaultswritecom.apple.ActivityMonitorIconType-int5# show all processes$defaultswritecom.apple.ActivityMonitorShowCategory-int0# sort via cpu usage$defaultswritecom.apple.ActivityMonitorSortColumn-string"CPUUsage"$defaultswritecom.apple.ActivityMonitorSortDirection-int0# update frequency$defaultswritecom.apple.ActivityMonitor"UpdatePeriod"-int"1"&&killallActivity\ Monitor# dock icon type## 1: regular icon$defaultswritecom.apple.ActivityMonitor"IconType"-int"0"&&killallActivity\ Monitor## 2: show network usage over time$defaultswritecom.apple.ActivityMonitor"IconType"-int"2"&&killallActivity\ Monitor## 3: show disk usage over time, as two mirrored line graphs$defaultswritecom.apple.ActivityMonitor"IconType"-int"3"&&killallActivity\ Monitor## 5: show the current cpu usages, as a verticle meter.$defaultswritecom.apple.ActivityMonitor"IconType"-int"5"&&killallActivity\ Monitor## 6: show cpu usage history, graphed over time$defaultswritecom.apple.ActivityMonitor"IconType"-int"6"&&killallActivity\ Monitor
# disable$sudolaunchctlunload-w/System/Library/LaunchDaemons/com.apple.metadata.mds.plist# enable$sudolaunchctlload-w/System/Library/LaunchDaemons/com.apple.metadata.mds.plist# [not recommended] hide icon$sudochmod600/System/Library/CoreServices/Search.bundle/Contents/MacOS/Search# stop indexing in a specific volume$sudomdutil-ioff"/Volumes/<name>"# stop mdutil in a specific volume$sudodefaultswrite/.Spotlight-V100/VolumeConfigurationExclusions-array"/Volumes/<name>"
# disable dialog$defaultswritecom.apple.TimeMachineDoNotOfferNewDisksForBackup-booltrue# or disable local backup$hashtmutil&> /dev/null &&sudotmutildisablelocal
# reveal ip address, hostname, os version, etc. when clicking the clock in the login window$sudodefaultswrite/Library/Preferences/com.apple.loginwindowAdminHostInfoHostName# revert$sudodefaultsdelete/Library/Preferences/com.apple.loginwindowAdminHostInfo
sleep mode
[!TIP]
check current status
$pmset-g# show detail$pmset-gassertions# show log$pmset-glog
# default$sudosystemsetup-getcomputersleepComputerSleep:after120minutes# never go to sleep mode$sudosystemsetup-setcomputersleepOff2024-12-0914:20:14.400systemsetup[18647:239595]### Error:-99 File:/AppleInternal/Library/BuildRoots/289ffcb4-455d-11ef-953d-e2437461156c/Library/Caches/com.apple.xbs/Sources/Admin/InternetServices.m Line:379setcomputersleep:Never# or$sudosystemsetup-setcomputersleepOff>/dev/null# get$sudosystemsetup-getcomputersleepComputerSleep:Never# disable computer sleep and stop the display from shutting off$sudopmset-asleep0$sudopmset-adisplaysleep0# disable hibernatemode to speeds up entering sleep mode$sudopmset-ahibernatemode0
# set display off timer$sudopmset-adisplaysleep30$sudopmset-adisplaysleep180Warning:Idlesleeptimingsfor"Battery Power"maynotbehaveasexpected.-Displaysleepshouldhavealowertimeoutthansystemsleep.Warning:Idlesleeptimingsfor"AC Power"maynotbehaveasexpected.-Displaysleepshouldhavealowertimeoutthansystemsleep.# get display off timer$sudopmset-g|grepdisplaysleepdisplaysleep180
set standby
# to 24 hours$sudopmset-astandbydelay86400
power button in stand-by mode
# disable$defaultswritecom.apple.loginwindowPowerButtonSleepsSystem-boolno# revert to original$defaultswritecom.apple.loginwindowPowerButtonSleepsSystem-boolyes
remove sleep image file
$sudorm/Private/var/vm/sleepimage# creating a zero-byte file instead of$sudotouch/Private/var/vm/sleepimage# make sure be rewritten$sudochflagsuchg/Private/var/vm/sleepimage
# allow large$defaultswritecom.apple.appleseed.FeedbackAssistantAutogather-booltrue# not allow$defaultswritecom.apple.appleseed.FeedbackAssistantAutogather-boolfalse
# disable$defaultswrite/Library/Preferences/com.apple.securityGKAutoRearm-boolfalse# revert to original$defaultsdelete/Library/Preferences/com.apple.securityGKAutoRearm