Show hidden files like .env and .htaccess for web work
Open a web project in Finder and half the files that matter aren't there. .env, .htaccess, .gitignore, .npmrc — every config file that begins with a dot is hidden by macOS. When you need to copy a .env, drag an .htaccess to a server, or check what your .gitignore actually contains, flip hidden files on: Cmd+Shift+. for one folder, or a permanent setting for your whole workflow.
Show them per window while you work
The quickest move, and the one most web devs use, is the toggle. It's scoped to Finder generally but you'll trigger it right where you need it.
- Open your project folder in Finder.
- Press Cmd+Shift+. (Command-Shift-Period).
.env,.htaccess,.gitignore, and the rest fade into view, dimmed to mark them hidden. - Do what you came for — copy, duplicate, drag, Quick Look — then press the shortcut again to hide them.
This is ideal when you dip into Finder occasionally but mostly live in an editor. Nothing to remember, nothing to reset.
Make config files visible for good
If you're in and out of project folders in Finder all day — staging deploys, comparing environments — set hidden files to always show. One command does it:
# Show .env, .htaccess and all other dotfiles in Finder
defaults write com.apple.finder AppleShowAllFiles -bool true
killall Finder
The killall Finder line relaunches Finder so it takes effect immediately. To go back to hiding them:
# Hide config files again
defaults write com.apple.finder AppleShowAllFiles -bool false
killall Finder
Both the shortcut and the command behave the same on macOS 13 Ventura, 14 Sonoma, and 15 Sequoia.
Two things worth knowing for web projects
- Your editor already sees them. VS Code, Sublime, and most IDEs list dotfiles in their own file tree regardless of this Finder setting — so you only need to unhide when you're working in Finder: copying a
.env.exampleto.env, or dragging.htaccessinto an upload window. - Watch the
.DS_Storefiles. With hidden files on you'll notice a.DS_Storein every folder — macOS creates them, and they easily sneak into commits and uploads. Add.DS_Storeto your.gitignore, and consider stopping them appearing on network shares.
One caution when deploying by dragging in Finder: with hidden files visible it's easy to also grab .git or .env and push secrets to a live server. Select deliberately, and never drag a whole project folder to a public web root with hidden files included.
Mainspring makes "show hidden files" a labelled switch — flip it on to work with .env and .htaccess in Finder, flip it off after. It's one of 90+ hidden macOS settings it turns into reversible toggles.
Signed & notarized by Apple · 1-day free trial · $29 once
While you're editing configs
Local web work often means pointing a domain at your own machine. Our guide to editing the hosts file on Mac pairs naturally with this — another hidden config file you'll want to reach without fighting Finder.