(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.
Fake Time Machine - "Fake Time Machine, a way to duplicate the functionality of Apple's Time Machine using rsync, which also might make it cross-platform, but also lets you run it to any remote server "
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
Inspect bytecode of CCleanerLib, contains debug symbols
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)
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)
~/Library/Preferences/Adobe/After Effects/11.0/Adobe After Effects Disk Cache - XXXXX.noindex (should be already ignored by Spotlight, but seem not work)
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)
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)
hdiutilcreate-size320g-typeSPARSEBUNDLE-nospotlight-fs"HFS+J"-volname"MyMacBook Time Machine Backup"MyMacBook.sparsebundle## Mount imageopenMyMacBook.sparsebundle# diskutil list# sudo diskutil enableOwnership /dev/diskXsX# Set Time Machine a destination volumesudotmutilsetdestination"/Volumes/MyMacBook Time Machine Backup"
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
hdiutilresize-size320g-shrinkonly/Volumes/Network_Drive_Name/path/to/timemachine.sparseimage# -limits will just displays the minimum, current, and maximum sizes (in 512-byte sectors)
reclaim unused bands (free space) sudo hdiutil compact -verbose image.sparsebundle (could be executed multiple times) or hdiutil resize -verbose -sectors min image.sparseimage.
#!/bin/bash# A bash script to create a time machine disk image suitable for# backups with OS X 10.6 (Snow Leopard)# This script probably only works for me, so try it at your own peril!# Use, distribute, and modify as you see fit but leave this header intact.# (R) sunkid - September 5, 2009usage(){echo ${errmsg}"\n"echo"makeImage.sh"echo" usage: makeImage.sh size [directory]"echo" Create a disk image with a max storage size of <size> and copy it"echo" to your backup volume (if specified)"}# test if we have two arguments on the command lineif [ $# -lt1 ]thenusageexitfi# see if there are two arguments and we can write to the directoryif [ $# ==2 ]thenif [ !-d $2 ]then errmsg=${2}": No such directory"usageexitfiif [ !-w $2 ]then errmsg="Cannot write to "${2}usageexitfifiSIZE=$1DIR=$2NAME=`scutil--getComputerName`;UUID=`system_profilerSPHardwareDataType|grep 'Hardware UUID' |awk '{print $3}'`# get busyecho-n"Generating disk image ${NAME}.sparsebundle with size ${SIZE}GB ... "hdiutilcreate-size ${SIZE}G-fsHFS+J-typeSPARSEBUNDLE \-volname'Time Machine Backups'"${NAME}.sparsebundle">>/dev/null2>&1echo"done!"echo-n"Generating property list file with uuid $UUID ... "PLIST=$(cat<<EOFPLIST<?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>com.apple.backupd.HostUUID</key> <string>$UUID</string></dict></plist>EOFPLIST)echo $PLIST >"${NAME}.sparsebundle"/com.apple.TimeMachine.MachineID.plistecho"done!"if [ $# ==2 ]thenecho-n"Copying ${NAME}.sparsebundle to $DIR ... "cp-pfr"${NAME}.sparsebundle" $DIR/"${NAME}.sparsebundle"echo"done"fiecho"Finished! Happy backups!"
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.
hdiutilconvert-formatUDSB-imagekeysparse-band-size=32768-onew.sparsebundleold.sparsebundle# Will take lot of time ~ hourscpold.sparsebundle/com.apple.TimeMachine.MachineID*new.sparsebundle/
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.
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)
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)
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.
macOS Monterey have issues with TimeMachine to mount volume over SMB. Try use AFP instead.
add .local to afp://machinename could be required (for local network)
in Finder connect first to the server and choose the right share (where sparsebundle will be), go to Time Machine settings and select the share. Unmount the share.
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"
hdiutilconvert-formatUDRW-o/path/to/target.img/path/to/ubuntu.isodiskutillist# (determine the device node assigned to your flash media (e.g. /dev/disk2))diskutilunmountDisk/dev/diskNsudoddif=/path/to/downloaded.img.dmgof=/dev/rdiskNbs=1Mdiskutileject/dev/diskN
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.
Applications (/Applications and /Library/Application)
User accounts and groups (reset UserShell and NFSHomeDirectory for created users) For macports, see:
if FileVault is enabled after macports has been installed (check it with sudo fdesetup list | grep macports), it could be necessary to disallow the user to decrypt the disk. Else it's visible on FileVault login window (even if it's a non interactive user). To disallow it: sudo fdesetup remove -user macports
https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob;f=packaging/macosx/Scripts/chmodbpf-postinstall.sh;hb=HEAD - postinstall script of Wireshark installer package
Other files and folders, which covers the Shared folder in the Users folder and folders you created at the top level of a drive
Computer & Network Settings
Setup Assistant (from clean install) or via /Applications/Utilities/Migration Assistant.app (could be problematic when migrate already exist accounts).
but doesn't migrate:
/etc/hosts
Time Machine configuration (destination and exclude list)
hostname (Settings > Share)
ByHost preferences
/Library/Logs/SystemMigration.log or /private/var/log/system.log (sender MigrateTool)
How it's work, Boot Camp Assistant automatically create 2 partition:
OSXRESERVED (Microsoft Basic Data / ExFAT, ~10GB, contains WinPE files, plus drivers in \$WinPEDriver$ and installer in \Bootcamp), which will be removed after the install of Windows is complete
BOOTCAMP (Microsoft Basic Data) partition where Windows is installed of the size the user gave
if you can start bootcamp OS (ex mounted in a Virtual Machine), install manually (download first: Download and install Windows support software on your Mac - Apple Support) by right click on each INF files, then "Install" (*\WindowsSupport\$WinPEDriver$\*\*.inf) (driver files will be copied in C:\WINDOWS\inf\*.inf, C:\WINDOWS\System32\drivers\*.sys and C:\WINDOWS\System32\DriverStore\FileRepository\*\*.*)
reboot if necessary (if the OS doesn't provide a PIN code but ask the one the device should provide)
Bluetooth dual boot:
Releases · headkaze/Hackintool - Tab "Utilities" > Button (at bottom with a Bluetooth logo) "Generate Windows Bluetooth Registry File", the import in Windows the file from regedit psexec -s -i regedit (psexec from PsTools - Windows Sysinternals | Microsoft Docs) See https://github.com/headkaze/Hackintool/blob/279644d917bd45241c85d13198a7ca4bacb320fd/Hackintool/AppDelegate.m#L10825-L10954 and https://github.com/headkaze/Hackintool/blob/279644d917bd45241c85d13198a7ca4bacb320fd/Hackintool/AppDelegate.m#L10713-L10755
tellapplication"Finder"set selection to make new fileat (get insertion location)end telltellapplication"System Events"tell process "Finder"keystroke returnend tellend tell
Convert :
use builtin quick action "Convert Image" (from macOS 12): file context menu > Quick Actions > Convert Image
Dans les fichiers .strings les retours à la ligne sont marqué . Voir aussi """, "\". Le commentaires supporté (/* ... */ et // ...). Ces fichiers doivent être enregistré en UTF-16
Keyboard with Mac layout: Settings > Time & language > Region & language > select current language > Options > Add keyboard > select the same language layout but with "(Apple)" > optionaly you can remove the previous layout or a keyboard layout selector in taskbar will appears
defaultsread.GlobalPreferencescom.apple.mouse.scaling# same value as System Preferences > Mouse > Speed#defaults write .GlobalPreferences com.apple.mouse.scaling -1
killmouseaccel:
Doesn't work with High Sierra due to depreciation of IOHID API.
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
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.
# Add a fake namexattr-wcom.apple.metadata:kMDItemDisplayNameDifferentFilename.txtActualFilename.txt# Hide file to Finderxattr-pxcom.apple.FinderInfo/path/to/filexattr-wxcom.apple.FinderInfo"0000000000000000400000000000000000000000000000000000000000000000"/path/to/file# or (spaces aren't important)xattr-wxcom.apple.FinderInfo"00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"/path/to/file# Find some hidden files (kMDItemFSInvisible mapped from the extended attribute com.apple.FinderInfo)mdfindkMDItemFSInvisible=1-onlyin.# Add custom colors and tags to a file# https://eclecticlight.co/2017/12/27/xattr-com-apple-metadata_kmditemusertags-finder-tags/# Rouge 6, Orange 7, Jaune 5, Vert 2, Bleu 4, Violet 3, Gris 1xattr-wxcom.apple.metadata:_kMDItemUserTags"62706c69 73743030 a3010203 584f7261 6e67650a 37585965 6c6c6f77 0a355949 6d706f72 74616e74 080c151e 00000000 00000101 00000000 00000004 00000000 00000000 00000000 00000028"filenamexattr-wxcom.apple.metadata:_kMDItemUserTags"$(echo '["Orange\n7","Yellow\n5","Important"]' |plutil-convertbinary1-o--|xxd-p|tr-d "\n")"/path/to/filexattr-wcom.apple.metadata:_kMDItemUserTags'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><array>...</array></plist>'/path/to/file# The following command works to (king of valid plist string)xattr-wcom.apple.metadata:_kMDItemUserTags'("Red\n6","Important")'/path/to/file# After change the metadata, Spotlight doesn't import the file immediatly. The workaround is to add another tag with UI (Finder) to all files, then remove it# Metadata see by Spotlight backend (metadata server)#mdimport -i filenamemdls-plist--name_kMDItemUserTagsfilename|plutil-convertjson-o--xattr-pxcom.apple.metadata:_kMDItemUserTags/path/to/file|xxd-r-p|plutil-convertjson-o--mdfind"kMDItemUserTags = Important"-onlyin.# or: mdfind "_kMDItemUserTags = Important" -onlyin .# Set custom application association# Even if the type is the default "public.data"xattr-wxcom.apple.LaunchServices.OpenWith"$(echo '{"version":1.0,"path":"\/Applications\/Hex Fiend.app","bundleidentifier":"com.ridiculousfish.HexFiend"}' |plutil-convertbinary1-o--|xxd-p|tr-d "\n")"filename# Get custom application associationxattr-pxcom.apple.LaunchServices.OpenWith/path/to/file|xxd-r-p|plutil-convertjson-o--# Set the URL from which the file was downloadedxattr-wxcom.apple.metadata:kMDItemWhereFroms"$(echo '["http://example.com"]' |plutil-convertbinary1-o--|xxd-p)"/path/to/filexattr-wxcom.apple.metadata:kMDItemWhereFroms"$(echo '["http://example.com/origin","http://example.com/referrer"]' |plutil-convertbinary1-o--|xxd-p)"/path/to/filexattr-wxcom.apple.metadata:kMDItemWhereFroms"$(echo '<plist><array><string>http://example.com</string></array></plist>' |plutil-convertbinary1-o--|xxd-p|tr-d "\n")"/path/to/file# Set the date when the file was downloaded# Note can't convert from JSON because datexattr-wxcom.apple.metadata:kMDItemDownloadedDate"$(echo "<plist><array><date>$(date+%Y-%m-%dT%H:%M:%SZ)</date></array></plist>" |plutil-convertbinary1-o--|xxd-p|tr-d "\n")"/path/to/file
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)
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
Metadatas: kMDItemContentType and kMDItemContentTypeTree (hierarchical content type); CFBundleDocumentTypes, UTImportedTypeDeclarations and UTExportedTypeDeclarations
Get UTI from metadata server:
mdls-raw-namekMDItemContentType $FILE
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
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -dump - list all registered UTI
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -kill -r -domain local -domain system -domain user - ro rebuild the Launch Services registry to fix a wrong attribution (after an App Upgrade)
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.
# Write 1GB of zero to tsfileddif=/dev/zerobs=1024kof=tstfilecount=1024# Will output (if locale is english):# 1024+0 records in# 1024+0 records out# 1073741824 bytes (1.1 GB) copied, 2.27431 s, 472 MB/s# Read tsfile (1GB)ddif=tstfilebs=1024kof=/dev/nullcount=1024# Remove tsfilermtstfile
<?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"><plistversion="1.0"> <dict> <key>Label</key> <string>local.mydaemon</string> <key>ProgramArguments</key> <array> <string>/path/to/binary</string> <string>arg1</string> <string>arg2=value</string> <string>arg3</string> </array> <key>RunAtLoad</key> <true/><!-- Use this for a script that runs once --> <key>LaunchOnlyOnce</key> <true/><!-- Use this user and/or group to launch daemon, remove if not defined --> <key>UserName</key> <string>SOME_USERNAME</string> <key>GroupName</key> <string>SOME_GROUP</string><!-- Save standard error to, remove if not needed --> <key>StandardErrorPath</key> <string>/dev/null</string><!-- Save standard output to, remove if not needed --> <key>StandardOutPath</key> <string>/dev/null</string><!-- Change start inverval, remove if not needed. See also LaunchOnlyOnce --> <key>StartInterval</key> <integer>30</integer> </dict></plist>
Note: Label must reflect filename without plist extension. Note: binary can be an executable (chmod +x /path/to/shellscript) shell script
# Check current user keyboard/usr/libexec/PlistBuddy-c"Print :AppleCurrentKeyboardLayoutInputSourceID"~/Library/Preferences/com.apple.HIToolbox.plist# defaults -currentHost read com.apple.HIToolbox# Set global/default keyboardsudo/usr/libexec/PlistBuddy-c"Set :AppleCurrentKeyboardLayoutInputSourceID com.apple.keylayout.French"/Library/Preferences/com.apple.HIToolbox.plist
See you current keyboard layout: ~/Library/Preferences/com.apple.HIToolbox.plist
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.
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)
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)
/usr/local, for self, inhouse, compiled and maintained software. /opt is for non-self, external, prepackaged binary/application bundle installation area
# 1. Install Xcode Command Line Tools: `xcode-select --install`# 2. Accept Xcode licence: `sudo xcodebuild -license`# 3. Check installed version (newer version can exist for php, node, python, perl, ruby, JDK, etc.)sudoportinstall \wget rsync \bash bash-completion \coreutils diffutilsfindutilsgsedgawkgpatch \watch \p5-file-rename \openssl \gzip gnutar \git \curl \gettext \ffmpeg \ImageMagick +rsvg \p5-image-exiftool \cmake \apache-ant \httrack \xorg-server# Start D-Bussudoportinstalldbussudoportloaddbus#sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist#launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist# Add `/opt/local/libexec/gnubin` to PATHif!grep-q"export PATH=/opt/local/libexec/gnubin:"~/.profilethenecho"">>~/.profileecho"# Use GNU coreutils by default (installed with macport)">>~/.profileecho"export PATH=/opt/local/libexec/gnubin:\$PATH">>~/.profilefi# To use bash_completion, add the following lines at the end of your .bash_profile:if!grep-q"/opt/local/etc/profile.d/bash_completion.sh"~/.bash_profilethenecho"">>~/.bash_profileecho"# Enable bash-completion">>~/.bash_profileecho"if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then">>~/.bash_profileecho" . /opt/local/etc/profile.d/bash_completion.sh">>~/.bash_profileecho"fi">>~/.bash_profilefi# NodeJS# Note: nodejs and npm without version specified are not the lastest available# sudo port install nodejs npmsudoportinstallnodejs15npm6# Add to profile node configif!grep-q"export NODE_PATH="~/.profilethenecho"">>~/.profileecho"# Use global node modules (installed with macport)">>~/.profileecho"export NODE_PATH=/opt/local/lib/node_modules:\$NODE_PATH">>~/.profilefi# NPM can be updated with:# sudo npm install -g npm@latest# Install globally some tools# use --python=python2.7 if required#npm install -g sqlite3# Note: never install globaly/system-wide npm packages (via `-g`). Install in ./node_module instead# Clean cache: `sudo npm cache clean`# If so packages are in /opt/local/lib/node_modules/ and remains even if npm is uninstalled or deactivate via macport# To see outdated packages, use `npm outdated -g --depth=0`# To update global packages, use `npm update -g`# Install PHP and composer (PHP package manager)sudoportinstallphpsudoportinstallphp80-intlphp80-openssl#sudo port select --set php php80# Create PHP config (dev only)sudocp/opt/local/etc/php80/php.ini-development/opt/local/etc/php80/php.ini# [#42344 (new composer port request) – MacPorts](https://trac.macports.org/ticket/42344)sudoportinstallphp74-iconvphp74-mbstringcurl-sShttps://getcomposer.org/installer|sudophp----install-dir=/opt/local/binsudoln-scomposer.phar/opt/local/bin/composer# Or use in each project's folder `php -r "readfile('https://getcomposer.org/installer');" | php && php composer.phar install`# Will install packages in ./vendor# Install python and pip (Python package manager)sudoportinstallpython39py39-pip#sudo port select --set python python39#sudo port select --set python3 python39#sudo port select --set pip pip39# Or for OSX's default python come with easy_install#sudo easy_install pip#pip install --user package# or#python -m pip install --user package# will install package in ~/Library/Python/X.Y/lib/python/site-packages# could also be in ~/.local/lib/pythonX.Y/site-packages# See# - https://pip.pypa.io/en/latest/user_guide/#user-installs# - https://www.python.org/dev/peps/pep-0370/# - https://stackoverflow.com/questions/15912804/easy-install-or-pip-as-a-limited-user# Install Python BeautifulSouppipinstall--userbeautifulsoup4# or with macports (system-wide):#sudo port install py38-beautifulsoup4# Then check#python -c "help('modules')" | grep bs4# Note: never install python packages system-wide http://scicomp.stackexchange.com/a/2988 (use always `--user`)# Install ntfs-3g https://trac.macports.org/wiki/howto/Ntfs3gFinder (need to disable SIP)sudoportinstallntfs-3g# TODO. See link# TestDisk and photorecsudoportinstalltestdisk# Ruby and gems (Ruby package manager)sudoportinstallruby27rb-rubygems#sudo port select --set ruby ruby27# Add to profile user's gems folderif!grep-q"export GEM_HOME="~/.profilethenecho"">>~/.profileecho"# Use user gems (rb-rubygems installed with macport)">>~/.profileecho"export PATH=~/.gem/bin:\$PATH">>~/.profileecho"export GEM_HOME=~/.gem">>~/.profileecho"export GEM_PATH=~/.gem:\$GEM_PATH">>~/.profilefi# Java / Open JDKsudoportinstallopenjdk15
How to fix "Failed to build osxfuse: command execution failed":
install builded version then create a symlink to fuse.pc: sudo ln -s /usr/local/lib/pkgconfig/fuse.pc /opt/local/lib/pkgconfig/fuse.pc
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
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.
# Rename all node_modules to node_modules.noindex and create a symlink node_modules -> node_modules.noindexfind/path/to/projects-typed \( -path'*/.*'-o-path'*node_modules/*'-o-path'*node_module.noindex/*' \) -prune-o-typed-name'node_modules'-execmv'{}''{}.noindex' \; -execls-s'{}.noindex''{}' \;
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
# Here the main drive mounted at /# turn indexing offsudomdutil-ioff/# delete Spotlight foldersudorm-rf/.Spotlight*# turn indexing onsudomdutil-ion/# rebuildsudomdutil-E/
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):
sudoopensnoop-nmdworker# Use 0.1 or 0,1 depends locale or prepend command with `LANG=C`: (eg. `LANG=C sudo watch -n 0.1 "CMD"`)sudowatch-n0"lsof +p PID"sudowatch-n0"lsof -c mdworker"strace-pPID-etrace=open,closesudofs_usage-w-ffilesysmdworker|grep"open"|less+F--follow-name
Erase all Spotlight data (all volumes):
sudomdutil-avE
Queries:
# Find all filesmdfind"*"mdfind-onlyin"/""kMDItemFSSize>0"# List all metadata for a specific filemdls/path/to/file# Find DMG filesmdfind-0"kMDItemFSName=*.dmg"# Find Finder excluded filesmdfind"_kMDItemFinderExcluded=*"mdfind"_kMDItemFinderExcluded=1"# Find user tags / colors set by usermdls-plist--name_kMDItemUserTags# Find ghost files ("if the Finder is in the middle of a copy and the source disk is suddenly disconnected") that aren't deletable ("Item XYZ is used by Mac OS X and can’t be opened.")mdfind-onlyin/path/to/files-0"kMDItemFSTypeCode==brok && kMDItemFSCreatorCode==MACS"|xargs-0-n1xattr-dcom.apple.FinderInfo# find all encrypted DMGmdfind-0"kMDItemFSName == '*.dmg'"|xargs-0-IXksh-c' if hdiutil isencrypted "X" 2>&1 | grep -q "encrypted: YES" then echo "X -ENCRYPTED" fi'
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
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
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: