macOS

Resources

purge

Time Machine

Informations

(Using AFP only) These presumably allow the disk image engine to force disk image journal data to write out all the way to the disk. Without such features, a network interruption can result in a corrupted filesystem on the disk image despite journaling. Remember, journaling relies on the journal being written all the way to disk before the changes take place. If you can't guarantee that (e.g., because of network/NAS buffering) then the journal is useless. Time Machine appears to rely heavily on disk journaling to deal with network drop-outs, interrupted backups, and the like. Take this away and your data is at risk.

Time Machine backup reliability:

Similar tools

See also Easy Automated Snapshot-Style Backups with Rsync

GUI for rsync

Include files and folders

Included by default:

From $IBACKUP_APP/Contents/Resources/System Settings/ iBackup

  • Address Book (Cards, Groups, Plug-Ins)

  • Dashboard

  • Desktop Pictures

  • Fonts

  • Keychains

  • Mail (Accounts, Mailboxes, Messages)

  • Printers

  • Safari (Bookmarks, History, Preferences)

  • Screen Savers

  • System Preferences (Bluetooth, Dock, Services ...)

  • iCal (Alarms, Events, To Do, Calendars)

  • iChat (Accounts, Preferences)

  • iMovie (Preferences)

  • iPhone

  • iPhoto

  • iPod

  • iTunes

Exclude drives, folders and files

By default some folder/files are excluded. But some are not to allow a full restoration of a viable system (ex: /private/var/log/ and its folders are kept but not their files).

How to:

  • Fixed path exclusions System Preferences > Time Machine > Options, similar to sudo tmutil addexclusion -p <drive, dir or file> (but it's not the same). See also /Library/Preferences/com.apple.TimeMachine.plist and /System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist

  • Sticky exclusions tmutil addexclusion <drive, dir or file> same as xattr -w com.apple.metadata:com_apple_backup_excludeItem com.apple.backupd <filename>. This not work for files inside packages (Spotlight don't index files in packages) find /path/to/projects -type d -path '*node_modules/*' -prune -o -type d -name 'node_modules' -exec xattr -w com.apple.metadata:com_apple_backup_excludeItem com.apple.backupd '{}' \;

  • files ignored by Spotlight still backup by Time Machine

Find sticky excluded files/folders sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"

See also

General

  • ~/Download

  • /Applications/Install OS X Yosemite.app

  • Folder of Dropbox, Box, Google Drive, iCloud (~/Library/Mobile Documents/) etc.

System

  • (not adviced) /private/var/folders/%random%/%random%/0/com.apple.LaunchServices-134$(id -u).csstore Sometime this file is updated too often (< 1h) (after each Time Machine backup?) Maybe a rebuild is necessary: find /System/Library/Frameworks -type f -name "lsregister" -exec {} -kill -seed -r \; or find /System/Library/Frameworks -type f -name "lsregister" -exec {} -kill -r -domain local -domain system -domain user \; Launch Services Database file is per user file 134 on OSX 10.11, an other number on other OSX version) contains software file type/protocol association and maybe Login Items too See com.apple.LaunchServices-014501.csstore keeps r... | Official Apple Support Communities

  • (can break restoration of the system, contains small files) /private/var/db/BootCaches/ and /private/var/db/systemstats

  • ~/.bash_sessions

By exploring Time Machine backups delete backup of content of /private/var/folders/ and files /private/var/log/ (but keep folders tree intact)

Steam

Virtual Machines and simulators

VMware, Parallels, VirtualBox, etc.

  • Virtual Machines.localized VMware Fusion

  • /Library/Developer/CoreSimulator/Profiles/Runtimes iOS simulator

  • /Library/Android/sdk/system-images Android SDK (depends installed location)

If possible, enable option to split vitual machine hard disk into small chunks. (VMWare Player: New Virtual Machine Wizard > Specify Disk Capacity > Split virtual disk into multiple files)

or use sparse bundle to store VMs disks

Adobe Creative Suite

  • ~/Library/Preferences/Adobe/After Effects/11.0/Adobe After Effects Disk Cache - XXXXX.noindex (should be already ignored by Spotlight, but seem not work)

  • Photoshop scratch disk's temp files (where ?)

Lightroom

  • ~/Pictures/Lightroom/Lightroom 5 Catalog Previews.lrdata

  • ~/Pictures/Lightroom/Lightroom 5 Catalog Smart Previews.lrdata

Xcode

  • /Applications/Xcode.app

  • ~/Library/Developer/Shared/Documentation/DocSets

  • ~/Library/Developer/Xcode/DerivedData

Google Chrome (see also Canary)

  • ~/Library/Application Support/Google/Chrome/Default/Application Cache and https://code.google.com/p/chromium/issues/detail?id=25959

  • ~/Library/Application Support/Google/Chrome/Default/GPUCache

  • ~/Library/Application Support/Google/Chrome/ShaderCache

  • ~/Library/Application Support/Google/Chrome/Default/Extension Rules/XXXXXX.log

  • ~/Library/Application Support/Google/Chrome/Default/Extension Rules/LOG

  • ~/Library/Application Support/Google/Chrome/Default/Extension Rules/LOG.old

  • ~/Library/Application Support/Google/Chrome/Default/Extension State/XXXXXX.log

  • ~/Library/Application Support/Google/Chrome/Default/Extension State/LOG

  • ~/Library/Application Support/Google/Chrome/Default/Extension State/LOG.old

  • ~/Library/Application Support/Google/Chrome/Default/Session Storage/XXXXXX.log

  • ~/Library/Application Support/Google/Chrome/Default/Session Storage/LOG

  • ~/Library/Application Support/Google/Chrome/Default/Session Storage/LOG.old

Spotify

  • ~/Library/Application Support/Spotify/PersistentCache (by default) or the path of Spotify Preferences > Advanced > Memory Cache

jDownloader

  • /Applications/jDownloader.app/Contents/java/app/tmp (use fixed path exclusion)

  • /Applications/jDownloader.app/Contents/java/app/logs (use fixed path exclusion)

Firefox

In ~/Library/Application Support/Firefox/Profiles/%ff_profile_id%/ files likes places.sqlite, cookies.sqlite, content-prefs.sqlite and webappsstore.sqlite can be quite big (N * 10MB) and often updated. Clean history and clean cookies or change places.history.expiration.max_pages and or places.history.expiration.interval_seconds. Could be safely deleted (a new file will be created when it is needed). Clean up sqlite DB (reduce size): echo "VACUUM;" | sqlite3 places.sqlite. See https://wiki.mozilla.org/Firefox/Projects/Places_Vacuum

~/Library/Application Support/Firefox/Profiles/%ff_profile_id%/weave/logs could be excluded too

Thunderbird

See Firefox for places.sqlite, cookies.sqlite, content-prefs.sqlite and webappsstore.sqlite

  • use maildir format in Thunderbird (store each email as individual file instead of a big file containing all emails)

  • ~/Library/Thunderbird/Profiles/%tb_profile_id%/global-messages-db.sqlite

  • ~/Library/Thunderbird/Profiles/%tb_profile_id%/global-messages-db.sqlite-journal

  • ~/Library/Thunderbird/Profiles/%tb_profile_id%/panacea.dat (Mail folder cache. It can be safely deleted)

MySQL

Use "InnoDB File-Per-Table Tablespaces":

In my.cnf

sparsebundle

Explore sparsebundle

Mount *.sparsebundle / *.backupbundle first: hdiutil attach My.sparsebundle

  • tmutil (with compare, uniquesize or calculatedrift): tmutil compare /Volumes/MyBackupVolume/Backups.backupdb/$COMPUTE_NAME%/2016-02-18-090818 /Volumes/MyBackupVolume/Backups.backupdb/$COMPUTE_NAME/2016-02-18-102050. + added file, - removed file, ! changed file

  • diskutil umount force /Volumes/com.apple.TimeMachine.TM_Prime-DA16D91F-3320-4834-91ED-2902CE57E46D

  • BackupLoupe - Explore version (compare changes, size)

  • TimeTracker by CharlesSoft - Not work well with network drives

  • find /path/to/your/latest/backup -type f -links 1 -print (Time Machine use hardlinks for unmodified files). But not realy usefull since some folder use hardlink too (and you can't exlude file in hardlinked folders)

Create or resize sparsebundle

Aka specify a size

Sparsebundle are use on network drives.

Create a sparsebundle of 320GiB or use 320000000000b (= 320GB)

To create dynamic sparsebundle, create it without partition scheme.

Sparsebundle will increase by it's content

You can shrink sparseimage directly (should not be used). Could require a compact before

Change sparsebundle band size

If "Time Machine must recreate a new copy" occure too often, or if after few month of TM use, back is slow, or if the host of the sparsebundle don't support well lot of file in one dir (ex: ext4 <40000)

By default Time Machine use band in sparsebundle with size of 8MiB. It's can be problematic when the size of the backup is > 300GB. 16MiB (32768 blocks) could be a good compromise.

Note: Increase band size only for unencrypted backups. Large bands could be problematic with encrypted backups (take lot of time): download band, decrypt, update, encrypt then finally upload

The sparse-band-size parameter is the number of 512-byte sectors (chunks), not the number of bytes. Since 512 is 1/2 1,024, then 262,144 B / 2 = 128 KiB.

Where 262144 equals 128MiB bands/byte sectors (128 MiBytes == 128*1024*1024 bytes == 128*1024*1024/512 blocks = 262144 blocks, 262144 / 2 / 1024 = 128MiB)

Read it (for mounted sparsebundle):

Backup into a sparsebundle file

This format is often created to backup on a shared network volume (that is not HFS+)

Mount it (db click in Finder) and

SparseBundle sould be at the root of the volume. A workaround is to create a symbolic link ln -s /volume1/backups/subfolder/subfolder/BackupImage.sparsebundle BackupImage.sparsebundle, but only supported on OSX (Unix folder symlink are forbidden)

Can be required

Control when to backup

More control, by can impact performances (battery, powernap, integrity, etc.)

Change:

  • (before 10.8) sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 7200 (7200 in seconds eq. 2 hours)

  • (10.8+) update BackupInterval in /System/Library/LaunchDaemons/com.apple.backupd-auto.plist

Or use an app:

Restore from a Time Machine backup

You can't restore this backup because it was created by a different model of Mac

Could restore from a Time Machine Backup with Migration Assistant.

Restore from a Time Machine backup should restore all files, but few things are not:

  • System Preferences > Keyboard > Keyboard Shortcuts (key mapping, "open terminal here", etc.)

  • Few softwares require to re-enter licencies credentials (which depends on hardware finger print?)

  • Some login credentials

  • System Preferences > Security & Privacy

  • scanners and printers drivers and configurations

  • file type/protocol association

  • Character map recent and favs

Also don't erase immediatly all TM snapshots, some are not complete due to concurency with software that also write on disk in same time (or use large files)

Change harddrive

Local snapshots

In folder /.MobileBackups

  • http://pondini.org/TM/30.html

  • http://apple.stackexchange.com/questions/80183/any-way-to-change-the-location-of-time-machine-local-backups-mobilebackups-t

  • http://support.apple.com/kb/HT4878

Remove specific file from Time Machine backup

Reduce size

Troubleshooting

Catalina have issue with SMB (often disconnected and sometimes can't reconnect). Force to use AFP mounted disk instead. See Time Machine in Catalina 10.15.3 has serious bugs – The Eclectic Light Company and Catalina - no longer access NAS via Finder? Time Machine not working. | Synology Community

Stuck on "Preparing backup..."

It's often related to spotlight indexing (can't backup when spotlight is indexing)

The backup is already in use

Aka "Failed to unmount disk mounted at [...]" on the server

On the server, disconnect the user or restart the AFP service

Time Machine backup is very slow

Disable low priority process throttle: sudo sysctl -w debug.lowpri_throttle_enabled=0. Check before if it's happend with sudo fs_usage -w -f filesys backupd

See also if it use SMB Shares, it could be slow itself (due to protocol version use or signing).

Other Time Machines errors

Time Machine Volume on Network

Via AFP (depreciated) or SMB protocols

Sparsebundle disk images cannot, however, be saved on SMB volumes and a handful of other filesystems due to their lack of support for "F_FULLFSYNC", which is a filesystem command that instructs the disk to write data from cache to media.

If you are using Netatalk version 2.0.5 or better, this has the special new features added to avoid Time Machine disk corruption. If you have a version of Netatalk earlier than 2.0.5 (e.g. Ubuntu 9.10 currently has 2.0.4) [..]

If you have Netatalk 2.0.5 installed, you should add the option “tm” to any share you use for Time Machine, in the AppleVolumes.default config file.

Using Ubuntu for Time Machine in Snow Leopard – Delivering Quality

sudo tmutil setdestination -p smb://user@Server._smb._tcp.local./Mount or sudo tmutil setdestination -p afp://user@Server.local/Mount

macOS Monterey have issues with TimeMachine to mount volume over SMB. Try use AFP instead.

iSCSI initiator

But how to restore, since iSCSI is not supported natively?

Quota

Limit per client:

Large modified files

Since TM it's a file level not block level backup, these files can be corrupted (not include all updates), because rewritten (partially or not) when backup, all changes are not backup. That means this files are backup corrupted.

Ex: Virtual Machine disk

Ex: MySql DB files. Solution: cron mysqldump hourly (or less if large DB) + exlude DB files

OS

  • OpenCore Legacy Patcher - "breathe new life into Macs no longer supported by Apple, allowing for the installation and usage of macOS Big Sur and newer on machines as old as 2007"

Install macOS

Use Option-Command (⌘)-R at startup to reinstall lastest version of the OS: How to reinstall macOS - Apple Support For clean install, erase the drive with Disk Utility (macOS Recovery) first

Create ISO installer:

Install on Virtual Machine

Bootable USB

macOS on Bootable USB

On an HFS+ (Journaled) formatted USB drive

Bootloader

Migration Assistant

Migration Assistant doesn’t overwrite new versions of applications with older ones [...] won’t overwrite an account with the same name by default. Migration Assistant prompts you about whether you want to rename the account from the old computer or overwrite the account on the new computer with the files from the old Mac [...] Files stored outside user accounts won’t be overwritten, but they could be merged, so a folder might contain a collection of old and new files.

Setup Assistant (from clean install) or via /Applications/Utilities/Migration Assistant.app (could be problematic when migrate already exist accounts).

but doesn't migrate:

Cleanup from previous upgrades

Use the Recovery System (restart and hold CMD+R)

Generate a list of files:

Compare 2 version (before and after clean upgrade):

After OS update some config files are replaced, where then previous one are kept and renamed as *~orig or *~previous

Note dirname command is not available in Recovery System

Before remove, backup unwanted files:

Files can be removed in 10.13.6:

Reset Setup Assistant

Integrate features of Migration Assistant.

Remove /var/db/.AppleSetupDone:

  1. reboot

  2. hold command + s

  3. in Terminal:

or:

  1. reboot

  2. hold command + r

  3. in Terminal ("Mackintosh HD" is the default name of the main disk, depends what has been defined when macOS was installed):

Boot Camp

Windows boot INACCESSIBLE_BOOT_DEVICE error (after Windows Updates):

How to install Windows:

Drivers:

Partitions:

Install on external drive:

Keyboard:

Bluetooth dual boot:

Change ownership

Network

Bandwidth limiter

Use "Network Link Conditioner" (but not work for localhost/127.0.0.1) or use a proxy instead (for HTTP/HTTPS)

Install:

  1. download "Additional Tools for Xcode" from https://developer.apple.com/download/more/?q=Additional%20Tools

  2. from DMG, double click to install Network Link Conditioner.prefPane

VPN

Local TLD

Use *.localhost instead of *.local. It's a reserved, internal TLD too.

Hosts files

Fake DNS records

Require root access to update the content:

Moved in CoreServices in 10.9

Flush DNS cache

Share network connection

UI

Finder, desktop, menus, etc.

Reveal Libray folder

Show hidden files

Or use the combination of Shift ⇧ Cmd ⌘ . or Fn Shift ⇧ Cmd ⌘ . (for French NUM? keyboards)

Hide specific file on desktop

If hidden files are not visible:

Else :

  1. Copy a transparent image (in preview: select image pixel area then copy)

  2. Past it as icon of targeted file

  3. Move to outside of desktop viewport

Reload "Open With" menu entries

Menulets are of small icons located at the upper right corner of the Menu Bar

/System/Library/CoreServices/Menu Extras/*.menu

Services

Aka quick actions

Located at ~/Library/Services/ and /System/Library/Services, packages *.workflow

Preferences > Extensions panel

To test a workflow with files, insert "Get Specified Finder Items" at the beginning

To assign a keyboard shortcut, in 10.6:

  1. open System Preferences > Keyboard > pane Keyboard Shortcuts

  2. select "Services" in the left pane

  3. scroll down to General in the right pane

  4. double-click to the right of the Automator workflow you just created

  5. press the keys you want to use, and switch panes to ensure the new shortcut is saved

For "Create a new file" quick action:

Convert :

Shortcuts

An PList file

Finder view preferences System-wide

  1. Close all Finder windows

  2. find ~ -name ".DS_Store" -depth -exec rm -f {} \;

  3. Kill finder: Force Quit → Finder

  4. Open a Finder window, edit Folder View Options show and click on "Use as default"

Localizable resource name

That use short language ISO code (ISO639).

Dans les fichiers .strings les retours à la ligne sont marqué \n. Voir aussi """, "\". Le commentaires supporté (/* ... */ et // ...). Ces fichiers doivent être enregistré en UTF-16

https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemAdvancedPT/LocalizingtheNameofaDirectory/LocalizingtheNameofaDirectory.html

System (default)

Edit following file (require root's right)

Add or update

.localized is an empty file (0 bytes)

Folder

In fr.strings:

  • /Applications/VMware Fusion.app/Contents/ResourcesVirtual Machines.localized/.localized/* (VMware Fusion 7.0)

Bundle

In Stuff/Info.plist, we found:

It's not required but I we want localizable bundle, we need it.

We can found also NSHumanReadableCopyright (copyright) and CFBundleName (display app name in menu bar) which are also localizable.

In Stuff/Resources/fr.lproj/InfoPlist.strings, we found:

Kiosk mode

Keyboard layout

macOS on a MacBook (without special keys like page up/down keys):

  • Page up : fn + up

  • Page down : fn + down

  • Home : fn + left

  • End : fn + right

  • Del : fn + backspace

  • Enter (num) : fn + return

Apple keyboard layout on Windows

See also Keyboard layout

Useful when you use a remote desktop connection. The host doesn't have the Apple keyboard layout.

DLL files are in %SystemRoot%\System32, copy them from Boot Camp drivers

Pointer

Aka mouse

Mouse acceleration

USB Overdrive works if you change system mouse speed to 0 (or -1)

System mouse speed

killmouseaccel:

Doesn't work with High Sierra due to depreciation of IOHID API.

Restart Dock

Will restart Dock, Mission Control, Spaces, etc.

For menubar

Or Finder

Spaces in dock

Media keys start Music.app

Aka media keys start iTunes.app, remote control daemon (RCD), play/pause keys (or bluetooth) auto-starting Music/iTunes, apple remote, connecting bluetooth headset/headphone

Note: looklike the side effects is media keys (of the keyboard or touchbar) stop working

Continuity with Android

Disk, file system and paths

  • disk path: /dev/diskX where X is a number (start with 1)

  • mounted in /Volumes/XXXX

See FileVault

Extended attribute

Aka quarantine, icons, thumbnail, xattr

  • com.apple.FinderInfo, which sets some general flags for Finder, and can be used to assign a single Finder Tag;

  • com.apple.metadata:_kMDItemUserTags, which contains Finder Tag settings;

  • com.apple.metadata:kMDItemDownloadedDate, which contains the datestamp for when this item was downloaded;

  • com.apple.metadata:kMDItemFinderComment, which contains the text from the Finder Comment but does not actually set it;

  • com.apple.metadata:kMDItemWhereFroms, which contains the URL of the location from which the item was downloaded;

  • com.apple.quarantine, which forms the quarantine flag to determine if Gatekeeper should perform a full check when an app is first run.

Where did that metadata come from? – The Eclectic Light Company

See also Spotlight and Uniform Type Identifier

Extended attribute com.apple.FinderInfo (same/similar binary format as resource fork):

com.apple.FinderInfo (XATTR_FINDERINFO_NAME, ATTR_CMN_FNDRINFO getattrlist(2)) 32 bytes of data for use by the Finder. Equivalent to the concatenation of a FileInfo structure and an ExtendedFileInfo structure (or, for directories, a FolderInfo structure and an ExtendedFolderInfo structure). These structures are defined in <CarbonCore/Finder.h>.

This attribute is not byte swapped by the file system. The value of multibyte fields on disk is always big endian. When running on a little endian system (such as Darwin on x86), you must byte swap any multibyte fields.

Other:

Icons and Cursors

Sounds

AFPS

Does Apple File System support directory hard links?

Directory hard links are not supported by Apple File System. All directory hard links are converted to symbolic links or aliases when you convert from HFS+ to APFS volume formats on macOS. — Frequently Asked Questions

NTFS

Read only

Use NTFS-3G or use exFAT instead (supported natively)

WebDav

Mount unsupported file system

Mount AFP share online

Don't do that! It's not secure (same for NFS, SMB/CIFS, iSCSI, etc.). Use it over a VPN (or a SSH tunnel) or use a secured protocol like SFTP (use https://github.com/osxfuse/osxfuse/wiki/SSHFS)

Can contains Time Machine backups.

Mount afp://ip_address/timemachine_share

Port 548 should be open (and forwarded (TCP) to the target if the server is behind a router). Don't allow guest access

Preference and help links

Open an pref

Open an app:

Home (help:anchor=%27access%27%20bookID=com.apple.machelp) Index (help:anchor=%27xall%27%20bookID=com.apple.machelp)

System paths

Re-add staff premission

Uniform Type Identifier

Aka UTI

Metadatas: kMDItemContentType and kMDItemContentTypeTree (hierarchical content type); CFBundleDocumentTypes, UTImportedTypeDeclarations and UTExportedTypeDeclarations

Get UTI from metadata server:

For the same extension, mutliple UTI definitions could exist. But the last definition will be used. Exemple: Adobe Flash use .as for ActionScript files (source code), but .as is declared instead as "AppleSingle archive" (UTI: com.apple.applesingle-archive). Installing Adobe Flash should override the default declaration. See uti - Revert Filetype Association - Ask Different

Fragmentation

Aka defragmentation

Disk image

Create a disk image from a disk or connected device

[...]

  • Sparse bundle disk image: Same as a sparse disk image (below), but the directory data for the image is stored differently. Uses the .sparsebundle file extension.

  • Sparse disk image: Creates an expandable file that shrinks and grows as needed. No additional space is used. Uses the .sparseimage file extension.

  • Read/write disk image: Allows you to add files to the disk image after it’s created. Uses the .dmg file extension.

  • DVD/CD master: Changes the size of the image to 177 MB (CD 8 cm). Uses the .cdr file extension.

[...]

Create a disk image from a folder or connected device

[...]

  • Read-only: The disk image can’t be written to, and is quicker to create and open.

  • Compressed: Compresses data, so the disk image is smaller than the original data. The disk image is read-only.

  • Read/write: Allows you to add files to the disk image after it’s created.

  • DVD/CD master: Can be used with third-party apps. It includes a copy of all sectors of the disk image, whether they’re used or not. When you use a master disk image to create other DVDs or CDs, all data is copied exactly.

Create a disk image using Disk Utility on Mac - Apple Support

Split disk image

Will generate files *.XXX.dmgpart and *.dmg

Folder action

See Automator

Test disk speed

aka test USB thumb speed

Clone to disk image

Startup and login

Startup chime

Not work with OSX 10.10+

Mute

Restore

  • http://apple.stackexchange.com/questions/168092/disable-yosemite-startup-sound

  • https://discussions.apple.com/message/28013107#28013107

Lock message

Aka login screen text

If found, please contact XXXX XXXX at YYYYYYYYYYY or at ZZZZZZ@ZZZZZZ.ZZZZ

Control+Command+Q

See also Change the language used at the login screen on your Mac - Apple Support

Reset NVRAM

And PRAM.

Start up item

With crontab -e:

With a shell script (as login item only):

In mystartupitem.command (why as *.command?)

An add it to login items (System Preferences → Users and Groups → Login items)

With a plist:

Create in /Library/LaunchDaemons (see also What are the differences between LaunchAgents and LaunchDaemons?) a file called like local.mydaemon.plist contains:

Note: Label must reflect filename without plist extension. Note: binary can be an executable (chmod +x /path/to/shellscript) shell script

Change/fix login keyboard layout

See you current keyboard layout: ~/Library/Preferences/com.apple.HIToolbox.plist

Security

System Integrity Protection

Aka SIP

  • /System

  • /usr

  • /bin

  • /sbin

  • apps that are pre-installed with OS X

Some specific softwares require to disable it

  1. in Terminal: csrutil status to check status

  2. restart

  3. hold down command-R to boot into the Recovery System

  4. in Utilities > Terminal csrutil disable; reboot or csrutil enable; reboot based on what you want

SIP only applies to the volume you're currently booted from, so [one can] boot from the backup volume to delete [files] CCC updated for El Capitan | Carbon Copy Cloner | Bombich Software

  1. just boot into "Recovery" mode by pressing "CMD+R" while rebooting.

  2. open Terminal

  3. your disk will be mounted in /Volumes/Macintosh HD (based on your drive name)

  4. update files (ex: delete files via rm): you have absolute control in that terminal

Terminal access error

If a command return an error like Operation not permitted, or cat: ~/Library/path/to/file: Operation not permitted, a SIP protected file is read.

Lift the restriction for Terminal: Operation not permitted - Mojave security?

App Sandbox

Downloaded file quarantine

or

Disable

Certificats

Delete Known Government-Linked Certificate Authorities: https://github.com/sammcj/delete-unknown-root-ca

FileVault

FileVault display a loginwindow at startup hask the user to decrypt the disk with its password.

FileVault is not allowed for all users

Firmware password

Users

Handled by OpenDirectory

UIDs < 500 are reserved.

  • auto login user defaults read /Library/Preferences/com.apple.loginwindow | grep autoLoginUser | awk '{ print $3 }' | sed 's/;//'

  • dscl . -read /Users/<username>

  • dscl . list /Users | grep -v '_' (prefixed user are daemons, etc.)

  • dscacheutil -q user

  • /var/db/dslocal/nodes/Default/users/*.plist data of OpenDirectory

  • sudo dscl . create /Users/<username> IsHidden 1, hide user on loginwindow and fast user switching: Hide a user account in macOS - Apple Support

  • disable guest user:

    1. ppen System Preferences

    2. go to "Users & Groups" and click the unlock icon

    3. click on “Guest User”

    4. uncheck the box for "Allow guests to log in to this computer"

  • hide a user from login screen: sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add <username>, to remove that config: sudo defaults delete /Library/Preferences/com.apple.loginwindow HiddenUsersList

Non interactive user

loginwindow UI will consider a user as one that can't be logged in if the following occur

the shell is /usr/bin/false

or

the AuthAuthority has ;disableduser; in it.

or

the AuthAuthority doesn't exist or contains ;basic; and the password is missing or is a single asterisk.

or

the record name is missing or blank [RealName?]

or

the uid is missing

loginwindow UI doesn't care about the UIDs number.

But the user still appears in System Preferences > Sharing > File Sharing | Screen Sharing | etc. > Add User dialog.

Applications

Self-signed application

Create a self signed certificate MyCertificateName with Keychain and trust it for all the system

That fix the issue with macOS open the alert popup "Do you want to the application MyAppName.app to accept incoming network connections?"

Define PATH globaly

Set export PATH=/my/path:$PATH in ~/.profile for command line, but not used by launched application (by spotlight, dock, finder, start restored windows)

A security update could break/change something:

it seems SIP strips env variables if an application is launched from another application

Open application (twice and so on)

Or add this as Automator script

Pass command line arguments to Application

Automator application

Automator > create an Application with Library/Utilities/Run Shell Script

Replace app icon: Get Info on original App, select icon, Cmd+C -> Get Info on target App, select icon, Cmd+V

Application bundle

See Create new application bundle. Not work anymore

Edit /Applications/Firefox.app/Contents/Info.plist, change for CFBundleExecutable or Executable File the value to firefox-bin-with-args.sh (the original is firefox-bin)

In /Applications/Firefox.app/Contents/MacOS/, create a file firefox-bin-with-args.sh (called like change in Info.plist)

  • http://superuser.com/questions/271678/how-do-i-pass-command-line-arguments-to-dock-items

Create new application bundle

Script app (bash script) can't start anymore with OSX 10.10: "Can’t open the application %s because PowerPC applications are no longer supported."

Allow Apps from Anywhere in Gatekeeper

"Allow apps downloaded from" "Anywhere" (from macOS Sierra)

"%s can’t be opened because it is from an unidentified developer"

Crtl + Click on the App > click on "Open" button to add the app to the approved list Right click > Open

Build-in Apache

Conf: /etc/apache2 Extensions: /usr/libexec/apache2 HTTPD_ROOT httpd -V

Restart Apache:

or

FileMerge

Xcode

"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo."

Accept for this account:

Accept for all accounts:

Install Xcode Command Line Tools:

Macports

Why use Macports instead of Homebrew: El Capitan and Homebrew | Hacker News TLDR: because it place packages in /opt/local and require sudo

Macports install in /opt/local where Homebrew install in /usr/local.

/usr/local, for self, inhouse, compiled and maintained software. /opt is for non-self, external, prepackaged binary/application bundle installation area

Macports is installed as root and uses its own account macports for some things.

Update and upgrade ports:

Install ports:

How to fix "Failed to build osxfuse: command execution failed":

App store

Aka MAS (macOS App Store)

Preference pane

Right click to remove prefpane

Quicklook generators

Aka QLGenerator

To view handle types:

Precedence :

The order is currently (from the less important to the most important):

  • System generators (in /System/Library/QuickLook - for Apple only)

  • Local (in /Library/QuickLook)

  • Home (in ~/Library/QuickLook)

  • Embedded in apps. (usally ./Contents/Library/QuickLook)

It's impossible to desactivate a QLGenerator for same level or above other than juste rename it folder or update it's Info.plist to reflect only wanted format support How to disable auto preview for *.doc *.docx in finder? - Ask Different http://lists.apple.com/archives/quicklook-dev/2010/Jun/msg00011.html

Spotlight

Aka Metadata Server (mds)

See also Extended attribute

Once the macOS does kick-off the extraction of metadata from a file, it does so through a Spotlight Importer. Spotlight Importers are plug-ins for the Mac OS that a developer provides specifically for helping files created by their applications to be searchable within Spotlight. Spotlight crawls through its list of changed files, handing each one to the appropriate importer. The importers then read the files, compile a list of metadata, and then hand the metadata back to Spotlight. At this point, the changed file is available for searching within Spotlight.

  • /System/Library/Spotlight

  • /Library/Spotlight

  • ~/Library/Spotlight

  • App ./Content/Library/Spotlight

  • /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker

  • /System/Library/LaunchDaemons/com.apple.metadata.com.apple.metadata.mds.scan.plist

  • /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Support/mds

  • /System/Library/PrivateFrameworks/SpotlightDaemon.framework/Versions/A/SpotlightDaemon

  • /System/Library/Frameworks/CoreSpotlight.framework/CoreSpotlightService

  • /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Support/corespotlightd

Turn off:

Note: extended attribute com.apple.FinderInfo doesn't have any impact, chflags hidden /path/to/file, touch folder-to-exclude/.metadata_never_index too

Reindex drive

Reindex (eq. Finder's Search not work properly): find . -name "*.md" -exec mdimport {} \; or sudo mdutil -E / (where / affect the whole volume, or all volumes)

List file indexing (where PID is pid of process of mdworker, use ps -e | grep mdworker):

Erase all Spotlight data (all volumes):

Queries:

Metadata importer

Aka Spotlight importers

Add to /System/Library/Spotlight/RichText.mdimporter/Contents/info.plist (get file format mdimport -n -d1 somefile.ext) to search inside source code:

Printer & scanner

Most post 2013 printers implement IPP Everywhere. AirPrint is based on IPP

Will ask username / password for shared printer, use Windows auth credentials or guest for the username and password. If not asked, delete the entry of password in keychain app

Calendar and contact accounts

CardDav, CalDav

SQLite3 with principalInfo binary PropertyList (plutil -convert xml1 -o - - < data.plist) (ZVALUE)

Old (not used to store accounts config):

See also the possibility to create configuration profiles:

Clipbload CLI

Simulate UI clicks from CLI

Corrupted executable script

Create a bash script and execute give:

bad interpreter: Operation not permitted

Scanning

SANE:

Automator

Delete core dump files

In /cores folder

Only deletes core files older than 24 hours.

Use cron or launchd

Screens and monitors

Custom screen resolution or HiDPI

OSCAR LCD Panel 1024 × 768 (HiDPI) fix

Find screen DisplayVendorID and DisplayProductID

Or in IORegistryExplorer (/Developer/Applications/Utilities/IORegistryExplorer.app) or IOJones, something like IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/P0P2@1/IOPP/GFX0@0/NVDA,Display-B@1/NVDA/display0/AppleDisplay

IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/P0P2@1/IOPP/GFX0@0/NVDA,Display-A@0/NVDA/display0/AppleBacklightDisplay is for built-in screen on Macbook Pro.

Map to /System/Library/Displays/Overrides/DisplayVendorID-XXXXX/DisplayProductID-YYYYY where XXXXX and YYYYY are 1 to N hexa char

Icon can be change be changed in /System/Library/Displays/Overrides/Icons.plist.

EDID can be override with IODisplayEDID. See [HOW TO] Advanced EDID Injection - Graphics Cards - InsanelyMac Forum

Problems

In log org.freedesktop.dbus-system Service exited with abnormal code: 1

Shutdown

DSLR as a webcam

Aka camera as webcam

For Linux use gphoto2 -> ffmpeg -> v4l2loopback. See How to use your DSLR from 2008 as a webcam in 2022 (NixOS) (see also this post on Hacker News)

Old, use Camtwist and Syphon or an OBS plugin:

Java

  • Java 8 is the only supported version which runs applets

  • /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java is Apple's Java version. Keep it. (/usr/libexec/java_home and /usr/bin/java point to it). See "Do NOT remove any content in the JavaVM.framework"

  • /System/Library/Java/JavaVirtualMachines/ is JDK location where Apple's Java 6 is installed (still the case?)

  • /Library/Java/JavaVirtualMachines/ default location of JDK installs

  • /usr/libexec/java_home -V get list of installed installed JVMs

Install JDK with sudo port install openjdk14 or download it from JDK Builds from Oracle. See also:

Uninstall Oracle Java by deleting the plug-in file (JRE, for applets):

Uninstall Oracle Java JDK:

macOS is Unix

And mostly POSIX-compatible

Screen capture

Aka screen cast, screenshot

Virtualization

See also:

Interoperability

Troubleshooting

ANS2 Recoverable Panic

Last updated

Was this helpful?