- The Terminal in macOS has some handy built-in features and utilities that can greatly enhance the user experience.
- Even though most of these features and commands are meant for advanced users, almost all Mac users can benefit from some of them as they are really easy to use.
- In this article, we present 5 essential macOS Terminal commands that every Mac user should know and use.
The Terminal application in macOS is one of the most useful tools available. Although some users prefer the more user-friendly approach of a graphical user interface (GUI), it’s important to remember that macOS originated from a command-line interface. Therefore, its roots are closely related to the Terminal. If you use this tool, you can greatly improve your usability and productivity. So here are five useful macOS Terminal commands that will simplify your everyday life and increase your productivity.
Table of Contents
The terminal is a powerful tool, but to take full advantage of it, we recommend installing a package manager called Homebrew. It’s like a missing package manager for Mac OS, with a huge selection of packages. If you’re a developer or frequently use CLI commands, it can simplify your workflow. Installing Homebrew is as easy as brewing your coffee and can also help you set up some useful macOS terminal commands and utilities.
Get old Wi-Fi passwords with the Terminal command
Your Mac stores records of all the Wi-Fi passwords you have ever used, and finding those passwords is easy using some simple terminal commands. This is a useful terminal command that can come in handy when you visit bars or restaurants with a new device. It is one of the most useful Mac terminal terminal commands to save time. You can use the command below to find the passwords:
security find-generic-password -wa "Wifi"
- Open the Terminal and paste the command from above.
- Once you’ve typed the command, change the Wi-Fi name to the name of the Wi-Fi you want to retrieve the password for; in my case, it’s “Motorola Edge 30”.
- Then your Mac will ask you for the admin name and password. Just enter the correct information and press Allow.
- And Voila! It will show you the correct Wi-Fi password.
The best part is that you don’t have to be present at the location to get a Wi-Fi password, and you don’t have to be connected to the Wi-Fi in question.
Enhance your screenshots with the Terminal
If you take a lot of screenshots and want to customize your Mac’s default behavior, such as how to name the screenshots, what the file type should be, and where to save the screenshots, these useful macOS Terminal commands will save you a lot of work and trouble. These are really useful macOS Terminal commands that will not only save you time but also greatly increase your productivity.
Change the name of your screenshots
Out of three commands in this section, this particular one is the most useful macOS terminal command that you can use to easily rename your screenshot because right now screenshots on Mac are randomly named. Here’s how to change the name of your screenshots:
- Open the Terminal
- Paste the following command
defaults write com.apple.screencapture name "[Name you want]"
Now you can see here the names of the screenshots are changed.
Change the default file type of screenshots
macOS saves screenshots in PNG format by default. The quality of the screenshots is excellent, but they take up a lot of storage. If you have a base Mac with only 256 GB of storage (or below) and take a lot of screenshots, we recommend changing the file type from PNG to JPG. You can do that with this useful macOS Terminal command:
- Open Terminal, and paste the above command.
defaults write com.apple.screencapture type
- And write the format type next to it.
- defaults write com.apple.screencapture type “jpg”
- And that’s it.
This Mac Terminal Productivity hack will help you to save some storage.
Change the location of the screenshots
By default, macOS stores all screenshots on the desktop, which makes it very cluttered. And you know a cluttered desktop ruins the mood; after all, the new Mac OS desktop is there to show your sick wallpapers and some important widgets. To save the screenshot to another location, just use this macOS Terminal command and follow these steps:
- Open Terminal, and paste the following command
default write com.apple.screen capture location ~/Desktop
- If you want to save the screenshots in another folder, write the location after the tilde character (~) like this
This productivity hack is one of my main Mac terminal utilities to increase my productivity and simplify my workflow.
Disabling Gatekeeper using Terminal
Gatekeeper is a security feature in macOS that is enabled by default. It prevents the installation of apps downloaded from the Internet unless the app has been verified and found to be safe. Although it’s a useful feature, we don’t recommend turning it off, but it can be annoying at times. However, if you are an advanced user who has recently switched from Windows or Linux-based distributions and you know what you are doing, you can disable Gatekeeper using this useful macOS Terminal command.
sudo spctl --master-disable
Here’s how to do it:
- Open the Terminal app
- Paste the command from above
- Enter your Admin password and it’s done.
Delete Download history from Terminal
Your Mac works like a database and collects information about all downloads, whether you use your browser’s incognito mode or not. This data is stored in a SQL Lite 3 database. If you don’t want others to know what you’re downloading for privacy and security reasons, here are two really useful macOS Terminal commands to help you out. It won’t necessarily increase your productivity, but it can improve your privacy and security. Here’s how:
- Open the Terminal app and paste the following command:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'
- This will select the entire download history and you will see a lot of empty space representing all your downloads.
- Now add the following command to clear the entire history:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'
- And voila, you have successfully deleted all old download history.
Don’t worry. You can still see all your downloads in the download section of your browser. The data from the database created by your Mac has been deleted.
Measure Internet speed from the Terminal
If you’re not a big fan of those internet speed test monitors that show your internet speed because they have a crappy website or sometimes just don’t work, then here’s the ultimate solution. You can check your network speed with these useful macOS terminal commands. You don’t have to visit a website to do it. Here’s how you can monitor your network speed right from the Terminal itself:
- Open the terminal and paste the following command
brew install speedtest-cli
- This command will install the command line app for speedtest.net
- Once installed, enter the following command to check your internet speed
This is one of the most useful macOS terminal commands if you want to check your internet speed without going anywhere, and one of the best Mac terminal tricks to increase your productivity.
Bonus Tip: CMatrix
Time for a bonus tip for those who made it this far: It may not be on the list of most useful macOS Terminal commands. This one will be a fun one. Ever wonder where the technology matrix effect comes from? You know, the one with the green icons flowing across a black background on a screen? You see that a lot in science fiction movies.
Here’s how to get it:
- Open the terminal and paste the following command
brew install cmatrix
- Then type the following command into the terminal and press Enter.
And that’s it. Now you can impress your friends and at least try to feel like the main character of a science fiction movie.
In summary, the Terminal app in Mac OS is a powerful tool that can greatly improve the user experience. In this article, we have discussed some useful macOS Terminal commands that every Mac user should know and use. These include finding old Wi-Fi passwords, improving screenshots, disabling Gatekeeper, clearing download history, etc. By using these useful macOS Terminal commands, you can simplify your workflow, increase your productivity, and improve your privacy and security. We hope these tips and tricks will help you get the most out of your Mac and make your computing experience more efficient and enjoyable.
FAQs about Useful macOS Terminal Commands
1. Why using the Terminal is better than the classic GUI approach?
Terminal in Mac OS provides much more efficiency and more access to the system level and even uses very few resources. Many useful macOS terminal commands consume less than 0.1% of system resources. It is ideal for tasks that require extreme precision, accuracy, and speed. It offers many useful CLI tools that consume very few resources and are extremely efficient to use. The graphical user interface is more user-friendly for everyday tasks but does not have the performance and efficiency of the terminal.
2. Is using Homebrew necessary?
Homebrew is a CLI-based package manager for the Mac OS, which improves the user experience by a lot, as it includes a lot of useful CLI-based apps such as Speedtest CLI, H-top, Youtube DL, etc. After this article, you will only miss Speedtest CLI and Cmatrix, but I recommend every Mac user to use it as it contains a lot of useful macOS terminal commands and tools that will make your CLI experience worthwhile.
3. After disabling the Gatekeeper in macOS, is there a way to enable it?
If you accidentally disabled Gatekeeper in macOS, you can re-enable it by simply typing the following command in Terminal.
sudo spctl --master-enable