Group session July 1st


The Missing Package Manager for macOS (or Linux)

We have these cute little icons and pretend folders as part of our operating system and graphical user interface. But behind that, the “applications” (computer programs) are just programs – and those are made up of a bunch of files. Those collections of files are often referred to as “packages.”

Mac doesn’t have a native package manager to add, update, or remove these packages. So, some nice people stepped in and made one. Instead of being part of the GUI, you work with it through the command line.

The project's website

Homebrew website

Open source projects usually have indepth directions on how to use them.

Head over there and see how it goes. Can you install it with just the information that is there?

Some things we'll use homebrew for

You do not need to install these right now. They’re just examples of a few things we’ll need.

  1. Download an app programmatically (without the GUI)

    You’re likely seeing this resource about homebrew because it’s the first day of writing HTML and we’re encouraging you to download a very simple text editor.

    Let’s download BBEdit – but from the terminal.

    Imagine you got a new computer at work – and you didn’t want to spend three days setting it up. Maybe you could create a set of directions to run in your terminal that would download all the applications you need and set them up. Fancy.

    Get it! (then check your /applications folder or search for BBEdit in spotlight)

  2. Download an app you can't find in the app store anymore

    It appears that the shortcut app we mentioned earlier Cheetsheet – isn’t maintained or available in an official capacity.

    But there’s a stable version of it somewhere – and you can download it with brew.

    (remember, you have to download homebrew before you can use it to download other software)

  3. Install another language on your computer

    Macs used to ship with programming/scripting languages like Python, Ruby, Perl, and PHP. But not everyone needs those, and there are other legal and licensing issues. So, the latest Macs don’t have these languages by default.

    This way, we can just install what we need.

  4. Switch between a version of an application

    In some cases, you might need to access an older version of an application. Maybe you have a file that doesn’t open on the new version, and the company’s website doesn’t give you an option to download the old one.

  5. You can also make your own programs

    Homebrew is a way to distribute your own programs.

Some core high-level functionalities

Most people use it to install software or switch between versions of a specific application, but if you’re curious, here’s a list of other uses.

  1. Software Installation: Homebrew allows you to easily install thousands of pieces of software with a single command, eliminating the need to download, configure, and install them manually.
  2. Dependency Management: It automatically manages dependencies for the software it installs, ensuring that all necessary libraries and other dependencies are installed and maintained.
  3. Software Updates: Homebrew makes it easy to keep the installed software up to date. You can update all software installed through Homebrew with a single command.
  4. Version Control: Homebrew allows users to install older versions of software or switch between versions, which is particularly useful for developers who need to test their applications against multiple versions.
  5. Customization: Users can create their own “taps” (additional repositories) and formulas (package scripts), which allow for customization and the addition of software that’s not available in the main repository.
  6. Environment Isolation: Homebrew installs software in its own directory and then symlinks its files into /usr/local. This keeps them isolated from the system software, which can help prevent conflicts and ensure stability.
  7. Scriptability: Its use of simple commands lends itself well to scripting, which can be useful for setting up new machines, automating installations, and maintaining consistent environments across multiple systems.
  8. Community and Support: It has a large and active community, which contributes to a vast repository of formulas (packages) and helps provide support and continuous improvement to the tool itself.

What does that crazy install command do?

Most people just paste it in and hit enter, and keep moving.

OK. Here’s the breakdown.

  1. /bin/bash: This invokes the Bash shell to run a command.
  2. -c: This option tells Bash to read the command from the next string supplied, instead of from the standard input or from a file.
  3. "$(curl -fsSL":
    • curl: A tool used to download files from a network.
    • -fsSL:
      • -f: Fail silently on server errors, useful for error handling.
      • -s: Silent mode, doesn’t show progress or error messages.
      • -S: When used with -s, it allows showing errors if they occur.
      • -L: Follows redirects if the server responds with a redirect.
    • URL to the raw shell script that installs Homebrew.

Most developers probably do not know what these things are doing. And that’s OK. You can’t know everything. And you don’t need to know everything either. If this becomes important, then great! Deal with it then.

Group session July 1st