Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Homebrew in Linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to install Homebrew in Linux". In daily operation, I believe many people have doubts about how to install Homebrew in Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to install Homebrew in Linux". Next, please follow the editor to study!

Homebrew is a software package management tool under the Mac OS platform, which has many practical functions, such as installation, uninstall, update, view, search and so on. A simple instruction, you can achieve package management, without you to care about various dependencies and file paths, very convenient and fast.

Step 1: install dependencies

You need to have relatively new versions of gcc and glibc. You can install the build-essential package on Ubuntu to get them. In addition, you also need to install Git, Curl and procps (to monitor the progress of the system).

On Ubuntu-and Debian-based systems, you can install all of these things together like this:

Sudo apt-get install build-essential procps curl file git

Iinstall dependencies for Homebrew in Ubuntu/Debian

For other distributions, use your package manager and install these dependencies.

Step 2: install Homebrew

You can see why you need to install Curl. It allows you to download the installation script file from the terminal.

Just enter this command:

/ bin/bash-c "$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

When asked to enter the enter key, press enter.

Installing Homebrew on Ubuntu

At the end of the script, it recommends running several commands to add them to the PATH variable. Homebrew is actually installed in your home directory and then soft-linked to the / usr/local directory.

Run the suggested command under Next steps to add Homebrew to PATh variable

You can easily copy and paste at the terminal. Just select the command it suggests, press Ctrl+Shift+C to copy, and press Ctrl+Shift+V to paste.

Alternatively, you can copy and paste this command directly:

Echo 'eval "$(/ home/linuxbrew/.linuxbrew/bin/brew shellenv)" > $HOME/.bash_profile

And then this:

Eval "$(/ home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Adding brew commands to the PATH

Step 3: verify the installation of brew

It's almost done. Simply verify that the brew command can be run by using the brew doctor command:

Brew doctor

The brew doctor command will tell you if there is any problem.

You can verify it again by installing the sample hello project:

Brew install hello

If you don't see any mistakes, you can enjoy homemade on Linux.

Use the brew command to install, remove, and manage software packages

Let me quickly tell you a few brew commands that you can use to install, remove, and manage software packages.

Because Homebrew is installed in your home directory, you don't need sudo to run it (like Pip and Cargo).

To install a software package with brew, use the installation option:

Brew install package_name

There is no automatic completion of the package name. You need to know the exact name of the package.

To remove a brew package, you can use the remove or uninstall option. The effect of both is the same.

Brew remove package_name

You can also use this command to list installed brew packages:

Brew list

You can also use the autoremove option to remove unwanted dependencies:

Brew autoremove

In the next screenshot, I installed only two packages with brew, but it also shows the dependencies of these packages. Even after the package is removed, the dependency still exists. Autoremove finally deleted them.

Listing and removing brew apckages

There are many brew command options, but this is beyond the scope of this tutorial. You can flip through its documentation at any time and explore further.

Remove Homebrew from Linux

This tutorial will not be complete without the steps to remove Homebrew from your Linux system.

According to the steps mentioned in the GitHub repository, you must download and run the uninstall script using this command:

/ bin/bash-c "$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

You will be asked to enter the Y key to confirm the deletion.

Removing Homebrew from Linux

When the uninstall of Homebrew is complete, it lists the files and directories it left behind:

Remaining files after Homebrew removal

Let you delete these files and directories yourself.

At this point, the study on "how to install Homebrew in Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report