LOGO

Best Command Line Tools for Mac with Homebrew

October 13, 2016
Best Command Line Tools for Mac with Homebrew

Unlocking Your Mac's Potential with the Terminal and Homebrew

The Terminal application on your Mac is a powerful tool. It allows you to perform tasks like downloading files, assessing your internet connection speed, and transforming image formats.

You can even access services like Pandora directly from the command line. These capabilities, and many others, are readily available through a few installations using Homebrew.

Expanding macOS Functionality Beyond Built-in Tools

We have previously demonstrated numerous terminal techniques within macOS, leveraging software already included with the operating system.

However, the functionality of your Mac's Terminal can be significantly expanded with the addition of free, third-party software.

Fortunately, a robust package manager named Homebrew simplifies the process of installing a wide array of helpful command-line utilities.

Getting Started with Homebrew

If you haven't already, familiarize yourself with the installation process for Homebrew. A comprehensive guide is available to assist you.

Once Homebrew is installed, you can explore a vast collection of tools designed to enhance your macOS experience.

This allows for a more customized and efficient workflow directly within the Terminal environment.

Related: How to Install Homebrew on a Mac

Utilizing wget for Comprehensive Downloads

wget stands as a powerful and versatile tool for downloading content, capable of handling both single files and complete websites. Installation is streamlined through package managers like Homebrew.

Installation via Homebrew

To install wget, simply execute the following command in your terminal:

brew install wget

Once installed, you can leverage wget’s capabilities for a wide range of download tasks.

Downloading Individual Files

For instance, to obtain the most recent version of Wordpress, the following command can be employed:

wget https://wordpress.org/latest.zip

This will directly download the specified zip file to your current directory.

Recursive Directory Downloads

The functionality of wget extends beyond individual files; entire directories can be downloaded recursively. Consider this example:

wget --level=1 --recursive --no-parent http://www.examplesite.egg/neatfiles/

This command will download the 'neatfiles' directory and its contents up to one level deep, preventing traversal to parent directories.

Exploring Further Options

The command wget --help provides access to a comprehensive list of options and functionalities.

By consulting this help documentation, users can unlock the full potential of wget and tailor its behavior to their specific needs.

wget offers a robust solution for automated and efficient file and website downloads, making it an invaluable asset for system administrators and developers alike.

Assess Your Internet Speed Utilizing speedtest_cli

Previously, we demonstrated methods for evaluating your internet connection speed through a web browser. However, a more efficient approach involves directly utilizing the Terminal and executing a command.

Installation Process

Adding this functionality is straightforward and can be achieved with a single command:

brew install speedtest_cli

This command, executed within the Terminal, will install the speedtest_cli tool.

Running the Speed Test

Once installed, initiating a speed test is remarkably simple. You can execute the test by typing either of the following commands into the Terminal:

speedtest-cli

Alternatively, you can use:

speedtest_cli

The results provided will mirror those obtained from the web-based version of Speedtest, but presented in a more concise, text-based format.

This streamlined output minimizes visual distractions, allowing for a quicker and more focused assessment of your internet performance.

Utilizing ansiweather for Terminal-Based Weather Updates

Obtaining a weather forecast directly within the Terminal environment is achievable and surprisingly straightforward. Installation is a simple process, enhancing your command-line experience.

Installation

The installation of ansiweather is facilitated through Homebrew. Execute the following command to install the application:

brew install ansiweather

Usage and Location Specification

Employing ansiweather requires the specification of your desired location. The command structure involves defining the location using the -l flag.

For instance, to view the weather in Hillsboro, Oregon, the command would be:

ansiweather -l Hillsboro,OR -u imperial

Command Breakdown

Let's dissect the components of this command:

  • ansiweather represents the program's executable name.
  • -l is the flag used to designate the location. Hillsboro,OR specifies the city and state.
  • -u allows for unit selection. imperial was chosen to display temperatures in Fahrenheit, consistent with US standards.

Further details regarding ansiweather’s functionality and options can be found on its official GitHub page.

While not necessarily an everyday tool, this application proves particularly valuable when integrated with desktop customization utilities like GeekTool, offering a convenient weather display directly on your desktop.

Utilize Mathematical Operations with calc

Transform your Terminal application into a fully functional calculator through the installation of the calc tool.

Installation Process

The installation is straightforward using Homebrew. Execute the following command in your Terminal:

brew install calc

This command will download and install the calc package on your system.

Launching and Using calc

Once installed, initiate the calculator by typing the following command:

calc

Upon launching, you can directly input mathematical expressions. The results will be displayed immediately.

Accessing Help and Tutorials

If you are unfamiliar with the syntax or available functions, a comprehensive tutorial is readily accessible. Simply type:

help intro

This will present an introductory guide detailing the program’s capabilities and the characters used for various operations.

calc offers significant computational power, and exploring its features is highly recommended for users requiring advanced calculations directly from the command line.

Personalizing Your Dock with dockutil

Various methods for customizing your Mac’s dock have been previously demonstrated. However, dockutil offers an even more extensive range of options and benefits from a streamlined installation process.

Installation

Installing this utility is straightforward using Homebrew. The following command will initiate the installation:

brew install dockutil

Once installed, you can leverage its capabilities to enhance your dock experience.

Adding Website Icons

dockutil is capable of adding a dock icon that directly links to any website. Consider the example of adding an icon for Facebook:

dockutil --add http://www.facebook.com --label Facebook

Let's dissect this command to understand its components:

  • dockutil
    identifies the program being executed.
  • --add
    instructs the program to create a new dock icon. The subsequent URL specifies the target website; applications or folders can also be designated.
  • --label
    allows you to assign a name to the dock icon, in this case, "Facebook".

Refreshing the Dock

After adding a new icon, it’s necessary to refresh the dock to ensure the changes are visible. This is achieved with the following command:

killall Dock

Executing this command will immediately display the new Facebook icon in your dock, enabling quick access to the website.

Beyond Websites

The functionality of dockutil extends beyond simply adding website shortcuts. It also supports the addition of applications, folders, and even blank spaces for aesthetic customization.

For a comprehensive overview of all features and functionalities, refer to the official dockutil page on Github.

Utilizing ImageMagick for Image Conversion

Previously, we detailed the process of image conversion and resizing utilizing ImageMagick within a Linux environment. The functionality remains consistent for users operating on macOS.

Installation via Homebrew

The initial step involves installing ImageMagick. This can be readily achieved using Homebrew, the package manager for macOS.

brew install imagemagick

Upon successful installation, the application becomes available for a wide range of image manipulation tasks.

Basic File Conversion

A fundamental operation is converting images between different formats. For instance, to transform a PNG file into a JPG, the following command is executed:

convert example.png example.jpg

This command efficiently alters the image's file type while preserving its visual content.

Advanced Image Manipulation

ImageMagick extends beyond simple format conversions. More complex modifications are also possible.

For example, adding a border to an image can be accomplished with a specific command.

convert -border 1x1 -bordercolor black testing.png result.png

This particular command adds a 1-pixel black border around the 'testing.png' image, saving the result as 'result.png'.

Further Exploration

The capabilities of ImageMagick are extensive. Users are encouraged to explore its full potential.

A comprehensive guide containing numerous useful techniques and information can be found in our original article.

Enjoy Pandora Radio via pianobar

While utilizing the terminal for music playback might appear unconventional, it offers a surprisingly effective experience. Pianobar facilitates the streaming of Pandora radio directly to your computer.

This is achieved through convenient keyboard shortcuts, bypassing the resource-intensive Flash-based website and eliminating commercial interruptions. Installation is streamlined with a single command.

Installation Process

The installation of pianobar is performed using the Homebrew package manager. Execute the following command in your terminal:

brew install pianobar

Launching and Configuration

After installation, initiate pianobar by typing the following command into your terminal:

pianobar

You will then be prompted to enter your Pandora account credentials. Upon successful login, you'll be ready to begin listening.

Station Selection and Control

Your available Pandora stations will be presented with corresponding numerical identifiers. Selecting a station is as simple as entering its number.

Keyboard shortcuts provide comprehensive control over playback. These allow you to perform actions such as skipping tracks and marking songs as liked.

A complete listing of available keyboard shortcuts can be accessed by pressing the "?" key during operation.

pianobar offers a streamlined and efficient way to enjoy Pandora radio, directly from your command line interface.

Utilizing darkmode to Switch Between Light and Dark Menu Bar Themes

Apple’s "Dark Mode," enabling a darkened menu bar, has been available to macOS users for some time. The darkmode application provides a streamlined method for activating and deactivating this feature directly from the Terminal.

Installation Process

The installation of darkmode is straightforward and can be accomplished using the following command:

brew install darkmode

This command utilizes Homebrew, a popular package manager for macOS, to download and install the application.

Toggling Dark Mode

After successful installation, switching between the dark and light menu bar themes is achieved with a single command:

dark-mode

Executing this command instantly alters the menu bar's color scheme.

While seemingly a minor utility, darkmode offers potential for integration into custom scripts for users with scripting knowledge.

Discover the Fun of Cowsay: A Command-Line Classic

A compilation of command-line tools for newcomers isn't truly complete without acknowledging cowsay. Simply input "cowsay" followed by any phrase, and an ASCII cow will repeat it back to you. It's a surprisingly delightful feature.

Installation with Homebrew

Installation is straightforward using Homebrew. The process is initiated with a single command:

brew install cowsay

This command efficiently adds cowsay to your system.

Beyond the Cow: Exploring Available Creatures

The utility of cowsay extends far beyond just a bovine speaker. A comprehensive list of all supported characters can be obtained by executing the following command:

cowsay -l

This will display a variety of options for your message delivery.

Customizing Your Message with Different Creatures

To have a creature other than the default cow deliver your message, utilize the -f variable. For instance, to have a dragon articulate the word "hello", the command would be:

cowsay -f dragon hello

This allows for a personalized and entertaining command-line experience.

the-best-command-line-tools-you-can-get-on-your-mac-with-homebrew-10.jpg

Interestingly, cowsay serves as an effective introductory lesson to the command line. Its simplicity and immediate feedback make it an ideal tool for beginners. It’s no surprise it frequently appears on lists of recommended command-line utilities.

Have fun experimenting with this engaging and educational tool!

#macOS#command line tools#homebrew#terminal#productivity#developer tools