Ios-homebrew MacOS Package Management

Source: Internet
Author: User
Tags install brew install homebrew homebrew cask brew cask

1, Homebrew Introduction 1.1 Homebrew
    • Homebrew is a software package management tool under MacOS platform, which has many useful functions such as installing, uninstalling, updating, viewing, searching and so on. A simple instruction, you can implement package management, without you care about the various dependencies and file path situation, very convenient and fast. Equivalent to Linux commonly used apt-get,zypper,pacman and so on.
2, Homebrew Environment Configuration 2.1 Homebrew installation Requirements
    • 1) Intel CPU

      • Official note not all directives have CPU or operating system requirements, and if they do not meet the system requirements, guess you will encounter problems. Additionally, you can view: Interesting Taps & Branches.
    • 2) MacOS 10.9 or higher

      • The official Referral system version is 10.9 or higher. 10.5-10.8 official will do their best to support. For 10.4 and 10.5, see Tigerbrew.
    • 3) Xcode command-line tool

      # 安装 Xcode command line tools$ xcode-select --install
      • Most commands require a compiler. A few need to install a full Xcode. You can install Xcode, or CLT, or both; The Homebrew supports three configurations. Downloading Xcode in a legacy operating system may require an Apple developer account, where you can register for free.
    • 4) Support Shell (SH or bash)

      • The single-line installation method can view brew.sh, but requires a compatible shell (such as bash or zsh). It is important to note that fish, tcsh, CSH will not work.
2.2 Installing Homebrew
  • Execute the following command in the terminal

    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
      • Terminal prompt

          ==> this script would install:/usr/local/bin/brew/usr/local/share/doc/homebrew/usr /local/share/man/man1/brew.1/usr/local/share/zsh/site-functions/_brew/usr/local/etc/bash_completion.d/brew/usr /local/homebrew==> The following existing directories would be made group writable:/usr/local/share/man/man5/usr/ Local/share/man/man7==> The following existing directories'll has their owner set to haiqianj:/usr/local/share/man/ Man5/usr/local/share/man/man7==> The following existing directories would has their group set to Admin:/usr/local/shar E/man/man5/usr/local/share/man/man7==> the following new directories'll be created:/usr/local/cellar==> the Xcode Command Line Tools would be installed. Press RETURN to continue or any other key to abort  
      • Enter the system password after pressing the RETURN key to continue the installation, wait a moment before the installation is complete.

  • Next, we need to do something to get the startup link (in/usr/local/bin) of the program installed through Hombrew to run directly without having to write out the full path.

    $ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
  • Cmd+t Open a new Terminal tab, run the following command to make sure that brew is working properly.

    $ brew doctor
  • When the installation is complete, homwbrew initializes the local/usr/local to the working tree of Git and changes the directory owner to the user who is currently operating, and no sudo is required for future brew-related operations.

2.3 Installing Homebrew Cask (optional installation)
    • With Homebrew Cask, you can install and manage MacOS GUI programs gracefully, simply and quickly, such as Google Chrome and Dropbox.

    • Install Homebrew Cask Run the following command to complete.

      # 添加 Github 上的 caskroom/cask 库$ brew tap caskroom/cask# 安装 brew-cask$ brew install brew-cask-completion# 更新$ brew update && brew upgrade brew-cask-completion && brew cleanup
    • If you want to see if there is an app you need on cask, you can search Caskroom.io.

2.4 Uninstalling the Homebrew method
    • Execute the following command in the terminal

      $ cd `brew --prefix`$ rm -rf Cellar$ brew prune$ rm `git ls-files`$ rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions$ rm -rf .git$ rm -rf ~/Library/Caches/Homebrew
2.5 Homebrew Common Commands
  • 1) Homebrew common commands

      # View Homebrew version $ brew-v# View Help information $ brew-h# Update Homebrew package directory on server side $ brew update# Install any Package # Brew Install [package name]$ Brew Install wget# Uninstall any package # Brew Uninstall [package name]$ Brew Uninstall wget# query available packages # Brew Search [package name]$ Brew SE Arch wget# View installed packages List $ brew list# view installed packages list including version number brew list--versions# View any package information # Brew info [package name]$ Brew Info wget# See if the installed package requires Update $ brew outdated# update the installed package, Homebrew will cache the old version of the package so that when you want to roll back to the old version using # Brew upgrade [package name] $ brew Upgrade wget # Clean up the old version of the package cache $ brew C  Leanup  
      Example usage:brew Search [text|/regex/] Brew (info|home|options) [FORMULA ...]  Brew Install FORMULA ... brew update brew upgrade [FORMULA ...] Brew Uninstall FORMULA ... brew list [FORMULA ...]  Troubleshooting:brew Config Brew Doctor Brew install-vd Formuladevelopers:brew Create [URL [--no-fetch]] brew Edit  [FORMULA ...] Https://docs.brew.sh/Formula-CookbookFurther Help:man Brew Brew help [COMMAND] Brew home  
  • 2) Homebrew Cask common commands

    • 1> installation File Preview Plugin

    • 2> Installing MacOS Graphical interface program

      #$ brew cask install alfred#$ brew cask install appcleaner#$ brew cask install cheatsheet#$ brew cask install dropbox#$ brew cask install google-chrome#$ brew cask install onepassword#$ brew cask install sublime-text#$ brew cask install totalfinder
2.6 Precautions
    • After MacOS 10.11 system,/usr/local/and other system directory of the file read and write is required system root permissions, the previous Homebrew installation if the installation path is not specified, will be installed by default in these directories that require the system root user Read and write permissions, Some instructions need to be added with the sudo prefix to perform, such as upgrading Homebrew, which requires executing the following command.

      $ sudo brew update
    • If you do not want to use the sudo command every time, there are two ways to choose.

      • 1> the root user authorization to read and write files in the/usr/local directory.

        # sudo chown -R [系统用户名] /usr/local$ sudo chown -R QianChia /usr/local
      • 2> (recommended) The installation path is specified when installing Homebrew and is installed directly in a directory that is free to read and write without the system root user authorization.

        [install path]/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Ios-homebrew MacOS Package Management

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.