There are many command line tools and scripts you can download and install that are very useful for Mac Admins.
Before we get right to how to install command line tools on macOS, let us look at what macOS Catalina is all about. Apple just made available a major release of its macOS codenamed macOS Catalina (version 10.15). MacOS Catalina is the sixteenth release of Apple’s desktop operating system for Macintosh computers. When we think of the macOS user interface, we think of the graphical UI—pointing and clicking icons, with a cursor, menus, windows, etc. But there’s another UI built into macOS: the command-line interface, which involves typing commands like the days of old. Mac OS X 10.9 comes with GCC and make included; after installing Xcode on your system, you can use them on the command line to create code. In this tutorial, we’ll be focusing on the command line components of Xcode. For those that would rather not install the whole package, those tools are all you need. Set up Internet Sharing on Mac OSX using Command Line Tools July 3rd, 2017. Even if Mac-OSX has a Unix core, Apple put some layers on top of it, which makes it rather hard to freely hack around. That's why I wrote an own small DHCP server recently. Configuring a Mac (Macbook Pro in my case) to act as a NAT router is hairy as well.
(Just a representative list, certainly not complete.)
Some of these tools provide installer packages that deploy the tool in the proper directory – usually
/usr/local/bin so that you and other users can use it. (
/usr/local/bin is in the macOS default
However, many of these tools, such as
munkipkg or my own
quickpkg just come as a
git project folder, with no or few instructions to get it set up. The assumption is, that when you use these tools you are familiar enough with the shell to make them work.
There are actually several approaches to getting these tools to actually work for you, most with different upsides and downsides. This post will talk about a few of them.
Before you can choose a method to run the tool, you need to get it. Many admins share their scripts and tools through a hosted service like Github. My
quickpkg tool, for example, is a python script hosted as an open Github repository.When you follow that link you will see the main project page. The page has a menu area up top, a file list in the middle and below an area where an introduction to the project (the ReadMe file) is shown. It is worth to read the ReadMe in case they have special installation instructions.
Git is a version management tool that lets you track changes throughout the coding process. Github is one popular service to host these projects online. Contributors of a project have the option of marking steps of the project as a ‘release.’ Releases are considered a tested and stable stop in between less reliable developmental steps.
Releases will be shown in the project’s ‘releases’ page (link in the middle of the page, above the file list). (quickpkg releases page
On the releases page you will see a list of releases with the newest on top. At the very least each release will have a snapshot of the project’s code as a
tar.gz archive. Some projects provide other archives or installers such as
pkg as well.
Some projects do not manage releases. (You will see ‘0 releases’ in the tool bar.) Then you can still download the most recent version of the project. There is a large green ‘Clone or download’ button on the right area above the project’s file list for this. When you click that button it will expand to show some more options.
‘Download ZIP’ will simply download an archive of the current state of project, much like the release download would.
When you download the archives, either through the releases page or from the ‘Download ZIP’ button, the resulting project folder will not be connected with the Github project any more. If you just want to use the current version, then that is fine and will serve you well. If you want an updated version in the future you will simply download the newer version and replace the tool you already have.
If you rather use
git to download and manage the code, then you can do that here, too. However, that is a topic for another post.
However you get the project you will now have a directory with the tool and any supporting files. You can already change directory to this folder in Terminal (drag the folder on to the Terminal icon to open a new Terminal already changed to it) and run the tool directly:
PATH environment variable lists the directories where the shell looks for commands. You could add the project directory of the tool you just added to the
PATH, but that would be tedious to manage.
An easier solution is to copy the tool to
/usr/local/bin. This is the designated directory for custom commands.
/usr/local/bin is also in the default macOS
However, copying the tool has some downsides. When the tool get’s updated you will have to copy the newer version, as well. Also some tools may require additional resources or libraries that reside in its project directory.
Instead of moving the tool, you can create a symbolic link to the tool in
I keep the project folders of tools in
~/Projects so I use the command:
Putting links to a tool in
/usr/local/bin has a few downsides (or upsides, depending on your perspective):
/usr/local/binlinks/tools you add to
/usr/local/binaffect all users on that Mac
When you want to have the tools only affect your shell environment you need to do a bit more work.
First you need to choose a location where you tools or links should live. I have created a directory
~/bin for that purpose.
(To test the following properly, you need to delete the symbolic link we created earlier in
/usr/local/bin. If that still exists the shell will use that, since it comes earlier in the
You can create a symbolic link to the in
To do that you need to add this line to your
Then open a new Terminal window or type
source ~/.bash_profile so that the new profile is loaded in the current window and try running the command.