You can do a lot with the macOS Terminal, but the commands tend to be obtuse. A free program called m-cli bills itself a Swiss Army Knife for macOS, and it makes a lot of these hidden commands a lot easier to learn and discover.
Terminal commands are rarely intuitive. For example, if you want to add a recent items folder to your dock, this is the command:
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = {"list-type" = 1; }; "tile-type" = "recents-tile";}' && \killall Dock
Stare at this long enough and you can kind of figure out what it all means, but it's hard to imagine many users discovering it on their own. With m-cli installed, however, the command is much easier:
m dock addrecentitems
M-cli makes hundreds of similar functions easy to discover and execute. Here's how to set it up, and what else you can do.
Installing m-cli in macOS
We've shown you how to install packages using Homebrew, and that's the easiest way to install m-cli. Once you have Homebrew set up, open the Terminal (Applications > Utilities > Terminal), then run the following command:
brew install m-cli
If you don't have Homebrew set up, head to the m-cli page on Github for alternative installation instructions. Homebrew is going to be easier for you, however, and will also help keep everything up-to-date easily. (Not to mention it has a bunch of other useful tools.)
How to Use m-cli
The number of functions m-cli offers can be intimidating, but it's ultimately quite simple. Most commands are just three words:
m
, followed by a two word command. To get started, type
m help
. This will give you a list of functions, which I also outline in the section below.
Each of these commands can trigger at least one functionality. To find them, type
m subcommand help
. For example, here's me exploring what
dock
can do:
As you can see,
dock
offers several tweaks. In the above example I turned magnification on and off.
To learn a bit more, here's a look at the
bluetooth
command.
As you can see, I can quickly turn Bluetooth on and off, and check the current status.
Finally, here's the
wifi
command:
As you can see, I can turn the Wi-Fi on and offer, but also recover passwords for any network or scan all networks that are nearby.
Everything m-cli Offers
As we've said, there are 30 commands, all of which offer at least one sub-command. Here's a quick outline of what all of these commands can do:
-
battery
-
bluetooth
-
dir
-
disk
-
dns
-
dock
-
finder
-
firewall
-
gatekeeper
-
group
-
hostname
-
info
-
lock
-
network
-
nosleep
-
ntp
-
restart
-
safeboot
-
screensaver
-
service
-
shutdown
-
sleep
-
timezone
-
trash
-
update
-
user
-
volume
-
vpn
-
wallpaper
-
wifi
Most of these things were possible to do from the command line before, but m-cli makes them a lot easier to discover and execute. If you're a command line junkie, there's no reason not to install it. And while you're at it, check out these other command line tools for Mac users.