For files hidden by prepended .
To show:
defaults write com.apple.finder AppleShowAllFiles YES; killall Finder
To hide:
defaults write com.apple.finder AppleShowAllFiles NO; killall Finder
edit: as per RikerW's advice, to shorten these long strings into some shorter strings, add the following line to ~/.bash_profile
from your favorite text editor:
alias showall='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder'
alias hideall='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder'
do note that you will have to do source ~/.bash_profile
to update your shell with the new aliases.
For files hidden from the GUI:
To show:
sudo chflags nohidden /path/to/file
To hide:
sudo chflags hidden /path/to/file
Do bear in mind that this completely removes the hidden
flag.
sudo
is strictly necessary though. – Markus Schanta Apr 09 '16 at 09:38chflags
works if you're the owner of the file, and if you're not, thensudo
is necessary. – perhapsmaybeharry Apr 09 '16 at 09:43.bash_profile
is generally a good idea. I haveshowall
andhideall
set to hide/show dotfiles. – Apr 09 '16 at 16:36chflags nohidden
didn't work, but what did work wasxattr -c /path/to/file
. It was the Finder info extended attribute that was hiding the file. – JWWalker Oct 01 '18 at 15:01xattr -rc /path/to/folder/*
(changing all hidden files & folders) is what ended up working for me on my MacBook Pro Mojave 10.14.2chflags
wasn't working. – JayRizzo Jan 06 '19 at 05:22