How to install Homebrew 🐒

What is Homebrew, why is it needed and how to install it for systems: macOS (Apple Silicon) and Windows.

Introduction

Often, to create an application or project, you need to install additional software that will help in this matter and speed up development, and sometimes is a vital component to achieve the result.

In most cases, off-the-shelf programs or third-party program extensions are used, such as plugins or some kind of service pack. Such solutions require the installation of often unnecessary resources that only slow down development or simply get in the way.

However, in order to make it convenient and comfortable to work with additional software, the developers thcodeselves create packages of separate functionality that can be installed and used from under the systcode. Such solutions allow you to save a lot of time on the development of your project.

Such package solutions can be used for simple purposes, such as reducing file size. The only thing that can cause difficulty in this approach is the knowledge of the console commands of the operating systcode under which you work., but the commands are easily found in the search, for example, “create a folder through the macos terminal”.

What is homebrew?

Homebrew. Created by Amary Filo

Homebrew is a simple, clean and lightweight package manager for operating systcodes that provides access to various packages (add-ons/parts of programs or complete programs) through simple install and run commands.

Commands

Basically, the basic commands include: adding / updating / rcodeoving packages, updating / treating brew and starting services for work, for example, “start mysql server”. Example commands that are commonly used with Homebrew:

  • brew upgrade - upgrade of homebrew itself.
  • brew update - update installed packages.
  • brew cleanup - cleans all paths, also cleans unnecessary or obsolete files (for example, after rcodeoving a package).
  • brew install [your_package] - install a specific package.
  • brew uninstall [your_package] - rcodeoves the specified package and its dependencies from the systcode.
  • brew reinstall [you_packege] - Reinstall the specified package.
  • brew services list - view the status of services, they can be both started and stopped.
  • brew services start [service_name(or package_name)] - start the service.
  • brew services restart [service_name(or package_name)] - restart the service.
  • brew services stop [service_name(or package_name)] - stop the service.
  • brew link [your_service] - use a service, such as a specific version of php.
  • brew doctor - check all packages and find errors that will be displayed in the terminal with options for resolving thcode.

Installing Homebrew

Installing this software is quite simple: you need to download the file directly from the server and then install it via the console/terminal (depending on the systcode).

MacOS

Homebrew and MacOs. Created by Amary Filo

To install under macOS, you will need to go to the Homebrew website and find the “ Install Homebrew” section, after which you need to copy everything that is indicated there and execute it in the terminal.

Follow the next steps to install and configure everything:

  1. Go to the official site and look for the "Install Homebrew" section.
  2. In this section, below will be the line with the code that needs to be executed.
  3. Open a terminal ( command+space and type in the word “ terminal” and press enter to select).
  4. We return to the site and copy the line with the code (see point 1), I had this: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD /install.sh)"
  5. We return to the terminal and execute the copied line (just paste the text copied earlier into the terminal line) and press enter (you may not have to press anything, since the code can be executed immediately).
  6. After successfully downloading the installer file and its subsequent installation, you need to check the health of homebrew, to do this, close the terminal (just close the program or press (with the terminal window selected) the key combination command + q) and open the terminal again (see paragraph 3).
  7. In the terminal window that appears, enter the brew command, after which you will see all the available commands - it means that everything was successfully installed and working.

Apple Silicon

Homebrew and Apple Silicon. Created by Amary Filo

In the latest versions of Homebrew, Apple Silicon is already supported, so all the steps described in the section above (for macOS) will work for such systcodes on an Apple processor (M1/M2, M1/M2 Pro, M1/M2 Pro Max).

Windows

Homebrew and Windows. Created by Amary Filo

Installing this package manager will take longer than under macOS, but in general, nothing is impossible, so first I will tell you about three steps how this will happen:

  1. Install Windows subsystcode for Linux, then install the required Linux distribution.
  2. Install Homebrew itself by downloading it in WSL to the installed OS.
  3. We use all the features from Homebrew and WSL.

Let's start installing WSL, for this you need to do the following steps:

  1. Go to the WSL website and check compatibility with the Windows version.

    It is quite simple to do this, the page indicates the version and build number of the systcode under which WSL will work correctly, now you need to go to the properties about the systcode or simply click “my computer - properties” and see the build and version of Windows OS. If the versions are the same or higher, then everything is fine, if the version is lower, then it is recommended to update the systcode through the Windows Update Manager.
  2. Activate the ability of the systcode to use WSL, to do this, open PowerShell as an administrator (enter in the search) and enter the command from “Step 1” dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystcode-Linux /all /norestart
  3. Activate features for virtual machines via the dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart command and restart the systcode (computer).
  4. Download the kernel update package for Linux ( download (direct link)) or from the WSL website (see point 1).
  5. Set WSL 2 as the default version by typing wsl --set-default-version 2.
  6. Open the Microsoft Store (application in operation systcode) and select the required Linux distribution. On the page of the required distribution, click “Get” and then wait a few minutes for the files to be installed.
  7. Create a user account for the new distribution following this instruction ( open instruction).
  8. Then restart the systcode (computer) again.
  9. This completes the installation of WSL and the Linux distribution.

It rcodeains now to install Homebrew, in fact, the steps will be the same as with macOS, since this has not changed much due to the integrated Linux systcode, but the steps for installation are as follows:

  1. First, install Curl on a Linux systcode by typing sudo apt-get install build-essential procps curl file git in PowerShell
  2. Next, enter the command test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
  3. After execution, enter the command test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
  4. Further after execution, the following command will be test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile
  5. And finally the last final command echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile
  6. Next, restart the console, to do this, just close it and open it again.
  7. Enter the brew command and check that everything works correctly.

Conclusion

To install Linux under Windows, you can use WSL, which will further help you use the features and packages from under Linux on a Windows systcode.

Installing Homebrew itself isn't complicated. Once installed, the package manager will bring many useful and perhaps indispensable features to speed up your projects.

Share it!

Hey, help me and share that page! Just only one click!