mac os

Top 10 Terminal Tricks in macOS

You can tweak a lot of settings from macOS’ System Preferences, but if you really want to dig deep and customize your system, the Terminal has a lot of hidden little tricks. Here are ten of our favorites in macOS.

Add Blank Spaces to the Dock

Your Dock is full of app icons and has become an unruly mess. How, then, do you organize it? By adding blank spaces, of course. These little separators help you group your apps however you want, which gives your eyes a break from a long continuous line of apps.

To add a blank space, use the command:

defaults write persistent-apps -array-add '{"tile-type"="spacer-tile";}'

Then type:

killall Dock

Repeat this procedure for as many blank spaces as you need. To remove one, just drag it off the Dock like you would any normal app icon.

Blanks spaces keep your Dock looks tidy and organized.

Now, if you have all your productivity apps together in one group, and your multimedia apps in another, you can quickly go through and find the apps you want.

Prevent Your Mac from Sleeping

If your Mac goes to sleep at inpportune times, you have a couple of choices. You can use a tiny little app to keep it awake, open up the Energy Saver preferences, or–more conveniently–employ the Caffeinate command. While the former two methods are just as effective, they involve a few more steps than just typing a simple Terminal command and being done with it.

Seriously, it’s that quick. Just open a Terminal and run:


…and your Mac will stay awake until you cancel it.

Caffeinate has a lot of options, though, like setting your Mac to stay awake for a certain amount of time. Check out our full guide to the Caffeinate command for more.

Expand the Print and Save Dialogs

Tired of always expanding the Print and Save dialogs on your Mac? Why not just make them permanently expand with two quick little Terminal commands?

The expanded Print dialog can only normally be access by clicking the “Show Details” button. Same goes for the Save dialog.

Simply run the following command to permanently expand Print and Save dialogs, respectively:

defaults write -g PMPrintingExpandedStateForPrint -bool TRUE
defaults write -g NSNavPanelExpandedStateForSaveMode -boolean TRUE

Once these commands are executed, you need to restart your computer to put them into effect and then you will have access to all the extra options on both dialogs without having to open the details.

Enable Key Repeating

This next item is more of a fix than a trick, in our eyes. As you might know, when you hold down a key on your Mac, it will display special characters if there are any assigned to it. Otherwise, it won’t do anything.

Some people however, might want the key to repeat, as computers have historically done. Not a problem, just use the following command and then restart your computer.

defaults write -g ApplePressAndHoldEnabled -bool false
 From then on, holding a key will repeeeeeeeat it, much like you’re used to with other computers.

To revert back to the special character mode, repeat the procedure only replace “false” at the end of the command with “true”. As always, be sure to read our article for a complete and thorough rundown.

Easily Copy Any Folder Path Into the Terminal

Say you need to access a file or execute a command from a specific Finder location, but you don’t want to type out the entire path. Trust us, that can be pretty tedious, especially if you get one small thing wrong.

In reality, it’s a snap to open any Finder location in Terminal. Just head to the folder in Finder, drag the folder or file onto the Terminal window, and just like magic that location will be displayed on the command line.

Easily Hide Folders in the Finder

 This next trick will actually let you use your newfound Finder-to-Terminal dragging skills. Because there’s no real way to hide Finder folders from the macOS user interface, you have to turn to the command line instead.

When you use this command:

chflags hidden /path/to/folder

It’s possible to instantly hide any Finder location.

The folder isn’t moved or deleted, it’s still there, you just can’t see it. So, if you want to tidy things up or hide stuff from prying eyes, use this command. You can read more about it here.

Use Your Screensaver as Your Wallpaper

While this next tip is completely non-essential, it’s still a lot of fun. By using the following simple command:

/System/Library/Frameworks/ScreenSaver.framework/Resources/ -background

You can use your screensaver as your wallpaper, meaning it will run on your desktop beneath your icons, open windows, and apps.


 Keep in mind that doing this might be a little hard on your Mac’s resources, so if you experience significant slowdowns, you might need to disable it.

We recommend you read our article if you want more information and a longer, more thorough explanation.

Change Your Screenshot File Type

 By default, macOS saves screenshots in PNG format, which works for us. But what if you want something else like JPEG or TIFF? You could re-save screenshot in another format using Preview, but that’s obviously kind of a hassle, especially if you have a lot of screenshots.

Another method is to simply change how macOS automatically saves them with this simple Terminal command:

defaults write type jpg

Just replace jpg with whatever extension you want to use, whether it’s JPEG, TIFF, or PDF. Follow that command with:

killall SystemUIServer

When you’re done, screenshots should be saved in the new format.

Change Where Screenshots are Saved

 While we’re on the subject, screenshots are saved to your Mac’s desktop by default, which is great in most cases, but what if you want to share screenshots with another computer? Or, more simply, you just don’t want your desktop to be cluttered?

With the following simple command, you can easily change where screenshots end up:

defaults write /path/to/location

Be sure to replace /path/to/location with the path to the folder you want screenshots to end up. Next follow up with the following command:

killall SystemUIServer

That’s it. If you ever decide you want to move screenshots back to the desktop, simply issue the command again with ~/Desktop as the location.

Quit the Finder

Our final favorite is also, in our opinion, one of the most useful–even if it doesn’t appear to do anything cool at first glance. WIth this simple Terminal command, you can add the ability to quit the Finder:

defaults write QuitMenuItem -bool true

Then, just follow it up with this command:

killall Finder

Once implemented, the Quit command will appear on your Finder menu, or you can just use Command+Q.

Why in the world would you ever want to do this? Whenever you quit the Finder, it also hides everything on your desktop. The items there don’t actually go anywhere, it just seems as if they do. This is great for those who want to do some quick cleaning, such as if doing presentations or just to foil prying eyes. Best of all, all you have to then do is simply restart the Finder to make everything instantly reappear.

Obviously there are a lot more you can do with the Terminal than these nine simple tricks, and we’ll surely be adding more in the weeks and months to come. In the meantime, try these out and see how they work for you.

Previous articleThe Best Command Line Tools You Can Get on Your Mac With Homebrew
Next articleWhat’s the Best antivirus for windows 10?
Technewborn is a leading problogging platform that covers the latest in technology, news, social media, mobile industry, apps, games, and more. I have been researching, writing, reading, living in it since 2009. I try adding a unique taste to whatever techy I write. You can follow me on below Social Network