Skip to content

Instantly share code, notes, and snippets.

@frazei
Last active January 29, 2024 10:01
Show Gist options
  • Select an option

  • Save frazei/4c04c55e9ac2ba4ea47ce43b974d1104 to your computer and use it in GitHub Desktop.

Select an option

Save frazei/4c04c55e9ac2ba4ea47ce43b974d1104 to your computer and use it in GitHub Desktop.
Hidden files in OSX #osx

Hidden files on OSX

The Quickest Way to Show/Hide Hidden Files

Since the release of macOS Sierra, when in Finder, it is now possible to use the shortcut:

CMD + SHIFT + .

The long way to show hidden Mac OS X files

Run the following command to show hidden files:

% defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder

Run the following command to hide hidden files:

% defaults write com.apple.finder AppleShowAllFiles FALSE;killall Finder

Cleaning

Delete "garbage" files:

find . -name .svn -exec rm -rf {} \;
find . -name ".DS_Store" -depth -exec rm {} \;

Delete existing Spotlight Index

% sudo rm -rfv /.Spotlight-V100

Delete all ._ file?

% find . -name "._*" -exec rm '{}' ';'

The ._ files are where osx puts the resource fork of a file if it's not on a HFS or HFS+ volume, eg, UFS, or Fat16/32 or NTFS (or any of the linux file systems).

Prevent MDS from attempting to Index

% sudo touch /Volumes/your volume name here/.metadata_never_index

Disable Indexing AND Searching of Volumes

% sudo mdutil -i off -d /Volumes/your volume name here

Disable creating '.ds_store' on USB volumes

% defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

Disable creating '.ds_store' on network volumes

% defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment