Mac CLI Simplifies Your Command Line So You Can Work Faster

Michael McConnell 26-07-2016

Mac CLI is an open source project that radically simplifies using Terminal on the Mac. Once upon a time when you turned on your computer, you were greeted with a blinking cursor. Then the Mac popularized the GUI, which still dominates the consumer market for its learning curve and ease of use.


But the Terminal is a powerful and fast way to work. That power comes with the caveat that you need to learn esoteric syntax, which isn’t intuitive.

Mac CLI makes it much easier to find and use these commands through its simplified syntax.

The Hard Part: Installing Mac CLI

You’re going to need your account to have admin rights at this point, and more advanced users can add their account to the Sudoers file. There are a few options to install the app from the project’s Github page with the  easiest being Curl.

Launch the Terminal (hit command+spacebar to bring up Spotlight and search for it) then paste this line of code into the command line:

sh -c "$(curl -fsSL"

Mac CLI will install several modules it needs: Homebrew, Git, Python, and Pipe Viewer. There are also some smaller packages: Glances, MySQL CLI, Speedtest-CLI iStats, and other utilities you can choose during the install process. I went with the defaults during the setup but feel free to skip the tools you don’t plan on using. It will save space on your drive as well as reduce the time it will take to update your system.



If you decide that Mac CLI isn’t for you, you can remove it using the command line as well. You may want to just reinstall to remove some of the unneeded modules. In any case, paste this command into Terminal:

sh -c "$(curl -fsSL"

You should review these sections of the project on Github, just so you’re aware of the changes it’s making to your Mac. I’ll try to note specific places where it happened, but I ran into quite a few odd permission issues running these utilities. It isn’t documented on the project page, but it looked to be an issue with El Capitan’s new security model What Mac Users Need To Know About El Capitan Security Security is the biggest change to OS X 10.11 El Capitan. OS X is now so locked down even root users can't modify the operating system – let's go over what that means, shall we? Read More (just my assumption based on the directories that threw an error) so your mileage may vary on what works based on your OS and user permissions.

The Basics: Simple Commands

Once you’ve installed Mac CLI, you can start pumping commands into Terminal or any command line client (like retro-inspired Cathode Cathode & Blinky: Sexy Vintage Replacements For Terminal & TextEdit [Mac OS X] Do you spend half your life inside the OS X Terminal? Is a plain text editor your second home? Whatever you do with Terminal or TextEdit there's no denying they're each a bit boring and... Read More ).


Mac Update


Updating your Mac is a bit easier since the advent of the Mac App Store. However, if you’re looking for a one line command line to invoke system update, this is about as simple as it gets.

mac update

That’s all you need to enter, which will invoke


sudo softwareupdate -i -a;

This will also check for updates on all of your installed Mac CLI utilities including Ruby Gems and Homebrew tools. If you run into some weird permission issues, this due to El Capitan’s stricter security measures.

Lock, Restart, Sleep & More


This is quite a nice set of commands to have access to. Locking a Mac when you’re in a shared office, or at the coffee shop, can be kind of annoying. Up until now, the easiest way was to set the screen saver to a Hot Corner 9 Mac System Preferences You Haven't Tweaked Yet Whether you're new to OS X or a longtime user, there's probably something in System Preferences you haven't found yet. Here are nine things you might have missed. Read More  or close the lid entirely. Now you can pull up the screen saver or lock with a single command.


mac lock

will run

/System/Library/CoreServices/Menu\ Extras/ -suspend

and take you back to the log in screen with the current user sessions till active. If your Mac is set to demand a password from the screen saver, it might be a bit easier to do that.

mac screensaver

subs for the much less intuitive

open -a /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/

and pulls up your screen saver.

Combining these with a keyboard launcher that supports Terminal commands makes controlling your Mac much simpler. If you set Mac CLI to echo the actual Terminal commands back to you, you can learn exactly what the command line has to offer for basic management of your Mac.

Network Commands


Getting your IP on your local network isn’t that difficult 9 Useful In-Built Mac OS X Utilities You've Probably Never Used While you're not forced to become familiar with them, there are a handful of useful utilities included with Mac OS X. Read More , but it saves a lot of time when it’s reduced to a one-liner.

mac ip:local

which translates to

ipconfig getifaddr en0

and returns your address on the local network. Getting your public IP is pretty much identical.

mac ip:public

which runs

wget -qO -

and returns your current public IP. Which isn’t quite as easy to get from standard utilities. Getting your local network speed isn’t hard, but doing it via the command line saves you a lot of superfluous animations.

mac ports

which is a shortcut to

sudo lsof -iTCP -sTCP:LISTEN -P

which will show you a list of all the active IP connections, and what port they are connected to.

None of these are advanced features, and you could do most of these in the GUI without too much effort. But they demonstrate how working with the command line can reduce several steps into a single line of text. Mac CLI makes it even simpler because you just need to remember a simple command name.

There is a speed test utility included in the Mac CLI package, but I wasn’t able to get it to work. I ran into an exception each time I ran it. The error looks to be an issue with the directory it installs into, and a required file doesn’t seem to have the right info. After some digging, I did find a simple command you can use.


wget -O /dev/null

Advanced Utilities: Resources and Remote Management

Now that you have played around with the basics let’s get deeper into working with your files.

Find Recent & Duplicate Files


There have been a few menubar utilities that try and help you look at recent files you’ve worked on. Enter the command:

mac find:recent n

n is the number of minutes, which subs the command

sudo find / -mmin n -type f

with your minutes substituted from n. It will then start searching every directory on your Mac, and sending back the files that have been altered in that time. It should be noted that it covers all files that have been changed, so you may run into utilities and logs that update often. You’ll also need to exit this command once it’s done searching with control+c.

Finding duplicate files is another frequent flier for utility apps, but Mac CLI turns into a simple command:

mac find:duplicated

That runs a search using the command:

fdupes -r .

You can control how deep the search goes by what directory you start from. If you only wanted to check user folders, you’d navigate to that directory before running the command. If you’re not sure how to do that, you enter cd and the file path:

cd /Users/Username/Documents

This lacks the built-in review and delete features of an app, but should be enough for smaller directories.

Memory Management


Activity Monitor isn’t bad, but you get some better data coming from top. Top is a command line utility that gives you a text breakdown of everything running on your system. There’s a lot more info than you’d get in Activity Monitor, along with each task’s PID (Process ID). With this, you can kill any program by using the kill command. You can invoke this with:

mac memory

Which pulls up top sorted by memory usage. It would be helpful if you could sort other ways, but since the command it pulls up is:

top -o MEM

If you’re looking for CPU, just replace MEM with CPU. I’m not sure why the CLI project doesn’t have this option. If you want network usage you can just run the command:


and see a list of active network connections. Hopefully, these two features get added in later releases. Consider these your first steps into using the command line without training wheels.

SSH Utiltities


SSH is a sysadmin’s best friend. It takes a bit to get used to the syntax, especially when you add SCP into the mix. With Mac CLI you can access all of them with a single set of commands.

mac ssh:download-file X

mac ssh:download-folder X

where X is the path of the remote file you want. You can do the reverse with the command:

mac ssh:upload X

If you’re working on development or other projects where you need your project folder to sync with a remote machine, you can do that as well:

mac ssh:sync:local X

mac ssh:sync:remote X

Once you get the hang of more advanced command line syntax, you can try the real thing with ssh, scp, and rsync.

Not Just For Beginners: Development Tools

If you’re a developer, you’ve probably got some solid command line skills. But Mac CLI isn’t just for newbies, there are a range of developer utilities too. Simplifying these can save you a lot of time when working.


MAMP Utilities

We’ve covered MAMP in the past 10 Essential Software Apps For Web Development on a Mac Read More ; it’s a dead simple way to set up a website. MAC CLI allows you to manage your entire server, including the MySQL database right from Terminal. This includes starting and stopping your server and working with your PHP install.

Git Utilities

If you are using Git for version control What Is Git & Why You Should Use Version Control If You’re a Developer As web developers, a lot of the time we tend to work on local development sites then just upload everything when we’re done. This is fine when it’s just you and the changes are small,... Read More and project management, you already know that its command line syntax is unique. With Mac CLI you can turn every Git command into short one-liners. The project page has a cheat sheet you can use.

The Alternative: FISH

If you’re not looking to change the default behavior of Terminal, FISH might be a better choice. We’ve covered it for Linux 7 Reasons Why You Should Install The Fish Shell Don't like how your Linux terminal works? Why not install a new shell? One such shell is fish, which introduces features that should have become commonplace, but didn't. Let's take a look. Read More , but it works on Mac as well. It installs alongside Terminal and uses more traditional syntax.


It’s a bit more focused on scripting features, like setting variables and loops. However, what comes in handy is the tab completion and suggestions. When you type commands, you’ll get suggestions on what you’re looking for, and then hit tab to complete your command.

FISH doesn’t simplify the command line in the same way as Mac CLI. However, it strikes a compromise between ease of use and sticking to the traditional syntax.

Taking Control Of The Command Line

Mac CLI should help you start working in Terminal more. Browse through the project page on Github to find more things you can do with Mac CLI. Working with the various utilities will allow you to get the hang of working with the command line for your tasks.

You’ll find that working this way saves you a lot of time, especially when you combine these commands with Quicksilver Remember Quicksilver, The Free Open Source Mac Launcher? You've probably forgotten entirely about Quicksilver, and that's too bad. It's awesome. Read More  or Alfred. Then you can just use a keyboard shortcut to send commands to Terminal with having to take your hands off the keyboard.

What’s your best command line time saver? Let us know in the comments.

Image Credit: Bake Patterson via Flickr, Jeremy Foo via Flickr, Aurimas via Flickr

Related topics: Command Prompt, Mac Tricks, Terminal, Unix.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *