Written by
Yvonne FengSummary: This post from iBoysoft tells you how to use Terminal commands to speed up Mac through clearing system cache, freeing up RAM, optimizing Finder performance, etc.
Is your Mac becoming slower over time? While macOS is optimized for performance, prolonged use can lead to background processes, cache buildup, and unused applications that may slow down your system.
Fortunately, you can use Terminal commands to optimize performance and speed up your Mac. This article will introduce some effective Terminal commands to speed up your Mac. Keep reading!
Clear system cache
Cache files are temporary data stored by macOS and applications to speed up access. However, these files can take up significant storage space and impact your Mac's performance over time. In this case, clearing the cache helps free up space and improve system speed.
Compared to manually deleting system cache files, using Terminal saves a significant amount of time by eliminating the tedious process of searching, selecting, and deleting files in Finder. It also reduces the risk of accidentally deleting important files, ensuring a safer and more efficient cleanup.
Here is how to do it:
- Open Terminal (Press Command + Space, type Terminal, and press Enter).
- Run the following command to delete user-level cache files.
sudo rm -rf ~/Library/Caches/* - To remove system-level cache files, run the following command.
sudo rm -rf /Library/Caches/* - If you also want to clear Safari's browser cache, type the command below.
rm -rf ~/Library/Safari/* - Restart your Mac to apply the changes.
Share this part to help more people clear the system cache!
Free up RAM
When the Mac's physical memory (RAM) is insufficient, the system writes part of the data to the swap space on the disk. However, disks are much slower to read than RAM, especially when using HDD or SATA SSDS, and even NVMe SSDS are much slower than RAM. Therefore, when macOS frequently uses swap space, the system stalls, application response is slow, and disk usage is high.
Using Terminal to release RAW materials reduces the dependence on swap space and prevents frequent disk reads and writes, thereby improving system fluency. Here's how to use Terminal commands to speed up your Mac.
- Open Terminal.
- Run the following command to force macOS to release inactive memory.
sudo purge - Wait a few seconds for the command to complete. Your system should now have more available RAM.
Optimize Finder performance
By default, Finder searches the entire Mac every time you open it, which can slow down performance. Changing Finder's default view and disabling previews can make it more responsive.
- Open Terminal on your Mac.
- Set Finder's default view to List View (which loads files faster than Icon or Column view).defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
- Disable file preview thumbnails, which can slow down folder loading. defaults write com.apple.finder QLInlinePreview -bool false
- Restart Finder to apply the changes. killall Finder
The above methods can reduce the system burden and improve the running speed of the entire Mac.
Disable unnecessary animations
macOS has many animations, such as those for opening windows, switching applications, and minimizing windows. Although these effects enhance the visual experience, they also consume system resources.
You can use Terminal to disable or shorten the animations, which speeds up application launching and window switching. Once disabled, Finder will open and close folders more quickly, and the overall system interface will appear smoother. Below are the specific commands to execute.
- Open Terminal.
- Type the following command to reduce Dock animations (e.g., when minimizing windows).
defaults write com.apple.dock reduce-motion -bool true; killall Dock - Disable window opening and closing animations.
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false - Disable Mission Control animations.defaults write com.apple.dock expose-animation-duration -float 0.1; killall Dock
After the above steps, restart your Mac so the changes take full effect.
Remove login items
Too many applications launching at startup can slow down boot time and consume system resources. Removing unnecessary login items speeds up startup and reduces background processes.
- You can open Terminal and first type the command to list all startup applications.
osascript -e 'tell application "System Events" to get the name of every login item' - Remove a specific application from startup (replace "AppName" with the actual application name).
osascript -e 'tell application "System Events" to delete login item "AppName"' - To remove all login items, run the following command.sudo defaults delete /Library/Preferences/loginwindow.plist AutoLaunchedApplicationDictionary
- Restart your Mac to apply the changes.
These five methods can effectively optimize your Mac's performance and help you achieve a faster, more responsive system. By leveraging Terminal commands, you can speed up your Mac for free without relying on third-party software.
Share the above 5 methods with your friends if you find them useful!