Installation and Use of homebrew

Source: Internet
Author: User
Installation and Use of homebrew

Feb 25 th, 2012

Mac OS X is a UNIX-based operating system and can install most of the software developed for Unix/Linux. However, it is not convenient to manually compile each software for the purpose of use, and it is not conducive to managing installed software, as a result, a software package management system similar to APT and Yum in Linux emerged, among which macports, Fink, and homebrew were the most famous.

I used to be a macports user, but after learning about homebrew, I immediately "quit. In fact, macports is also a very good solution, in addition to a feature that really makes me a headache. Macports has a principle that dependencies between software packages are all resolved within macports (/opt/local). No matter whether the system itself contains the required libraries, it will not be used. This makes macports too large and bloated, resulting in a large number of software package redundancy in the system, occupying a large amount of disk space, while a slightly larger software compilation time will be unbearable.

The homebrew principle is the opposite. It tries its best to use the various libraries provided by the system to shorten the Compilation Time of software packages. At the same time, it will hardly cause redundancy, the management of software packages is also clear and flexible. Another feature of homebrew is the use of ruby-defined software packages for installation and configuration (called formula), which is very simple to customize.

As for Fink, It is not discussed because it has not been installed and used. (From the Internet, Fink does not update software packages very timely due to manual maintenance issues .) For me, homebrew is well-developed. I am not interested in other software package management systems unless I find a major problem or a new breakthrough competitor.

The following describes how to install and use homebrew.

Homebrew Installation

First, make sure that your system meets the following requirements:

  1. Based on Intel CPU
  2. The operating system is Mac OS X 10.5 leopard or later.
  3. Installed version management tool git (Mac OS X 10.7 lion is pre-installed)
  4. Xcode development tool 1 is installed
  5. Java developer update2 installed

NOTE 1: In xcode 4.3, the command line compilation tool is optional and must be installed inPreferences>Downloads.
NOTE 2: (optional) homebrew does not rely on Java itself. Only Java is required for installation of some software packages.

Homebrew installation is very simple. Enter the following command in the terminal program.

ruby
-e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Because the installation address of homebrew may change, go to the official website to check the latest installation method.

Enter the root password during installation.

Homebrew usage

The executable command of homebrew is brew. The basic usage is as follows (take wget as an example ).

Search for software packages
brew
search wget

Install software package
brew
install wget

List Installed Software Packages
brew
list

Delete a software package
brew
remove wget

View software package information
brew
info wget

List dependencies of software packages
brew
deps wget

Update brew
brew
update

List outdated software packages (installed but not the latest version)
brew
outdated

Update outdated software packages (all or specified)
brew
upgrade
Orbrew
upgrade wget

Customize your own software packages

What should I do if the required software package cannot be found in homebrew? After all, homebrew is a new project and cannot meet the needs of everyone. Of course, we can compile and install the software package by ourselves, but the manually installed software package is not convenient to manage because it is not out of homebrew.

As mentioned above, homebrew's ruby-based software package configuration is very convenient. Next, let's talk about how to customize the software package (assuming the software package name is bar, from the foo site ).

  1. First, find the source code of the software to be installed.
    http://foo.com/bar-1.0.tgz

  2. Create your own formula
    brew
    create http://foo.com/bar-1.0.tgz

  3. Edit formula. After the previous step is successfully established, homebrew will automatically open the newly created formula for editing. You can also use the following command to open formula for editing.
    brew
    edit bar

    The formula automatically created by homebrew already contains the basicconfigureAndmake
    install
    Command, for most software, do not need to modify, just exit the edit.

  4. Run the following command to install the custom software package:
    brew
    install bar

For other features of homebrew, such as submitting a custom software package to the official release, refer to the home page of the Homebrew project and its man page. You will find that homebrew is not only a "Homebrew", but also a "Homebrew ".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.