How to show hidden files on macOS 10.12 Sierra

There are thousands of hidden files on your mac, usually they are hidden because they shouldn’t be meddled with, but there are many cases where you want to access those files, especially as a programmer. You might want to edit a .htaccess file or access your user library folder that has been hidden in macOS since OS X 10.7 Lion.

To show all hidden files, open Terminal in /Applications/Utilities/ and run:

defaults write AppleShowAllFiles 1

and then restart Finder by running:

killall Finder

To hide all hidden files, you run the same command, except change the 1 to a 0, like this:

defaults write AppleShowAllFiles 0

Here’s a useful function I made, it will check if hidden files are hidden/unhidden, and will unhide/hide them depending on which state they are in. You can add this to your .bash_profile in your user folder, and run it at any time by running the command hiddenfiles.

hiddenfiles () { if [[ $(defaults read AppleShowAllFiles) == "0" ]]; then defaults write AppleShowAllFiles 1; else defaults write AppleShowAllFiles 0; fi && killall Finder ; }

You can also hide or unhide individual files. To unhide your user Library folder for example, run:

sudo chflags nohidden ~/Library

To hide it again, run the same command except change nohidden to hidden, like this:

sudo chflags hidden ~/Library

How to install Homebrew on macOS 10.12 Sierra

Homebrew is, in my opinion, an essential package manager for macOS. According to Homebrew’s website it “installs the stuff you need that Apple didn’t”.

Before installing Homebrew, you have to get Xcode from the App Store.
After you have downloaded Xcode, open the “Terminal” app in /Applications/Utilities/, and run:

xcode-select --install

to install the Xcode command line tools.

Xcode Command Line Installation

Then, run:

ruby -e "$(curl -fsSL"

And let Homebrew install.

How do you use Homebrew?

Some commands you can run are:
brew search [TEXT|/REGEX/]
brew (info|home|options) [FORMULA...]
brew install FORMULA...
brew update
brew upgrade [FORMULA...]
brew uninstall FORMULA...
brew list [FORMULA...]