为有牺牲多壮志,敢教日月换新天。

安装Homebrew:macOS(或 Linux)缺失的软件包管理器

★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
➤微信公众号:山青咏芝(let_us_code)
➤博主域名:https://www.zengqiang.org
➤GitHub地址:https://github.com/strengthen/LeetCode
➤原文地址:
➤如果链接不是山青咏芝的博客园地址,则可能是爬取作者的文章。
➤原文已修改更新!强烈建议点击原文地址阅读!支持作者!支持原创!
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

热烈欢迎,请直接点击!!!

进入博主App Store主页,下载使用各个作品!!!

注:博主将坚持每月上线一个新app!!!

Homebrew:macOS(或 Linux)缺失的软件包的管理器

  • 安装 Homebrew

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

    将以上命令粘贴至终端。

    脚本会在执行前暂停,并说明它将做什么。高级安装选项在 这里

  • Homebrew 能干什么?

    使用 Homebrew 安装 Apple(或您的 Linux 系统)没有预装但 你需要的东西

    $ brew install wget
  • Homebrew 会将软件包安装到独立目录,并将其文件软链接至 /usr/local 。

    1 $ cd /usr/local
    2 $ find Cellar
    3 Cellar/wget/1.16.1
    4 Cellar/wget/1.16.1/bin/wget
    5 Cellar/wget/1.16.1/share/man/man1/wget.1
    6 
    7 $ ls -l bin
    8 bin/wget -> ../Cellar/wget/1.16.1/bin/wget
  • Homebrew 不会将文件安装到它本身目录之外,所以您可将 Homebrew 安装到任意位置。

  • 轻松创建你自己的 Homebrew 包。

    $ brew create https://foo.com/bar-1.0.tgz
    Created /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/bar.rb
  • 完全基于 Git 和 Ruby,所以自由修改的同时你仍可以轻松撤销你的变更或与上游更新合并。

    $ brew edit wget # 使用 $EDITOR 编辑!
  • Homebrew 的配方都是简单的 Ruby 脚本:

     1 class Wget < Formula
     2   homepage "https://www.gnu.org/software/wget/"
     3   url "https://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz"
     4   sha256 "52126be8cf1bddd7536886e74c053ad7d0ed2aa89b4b630f76785bac21695fcd"
     5 
     6   def install
     7     system "./configure", "--prefix=#{prefix}"
     8     system "make", "install"
     9   end
    10 end
  • Homebrew 使 macOS(或您的 Linux 系统)更完整。使用 gem 来安装 RubyGems、用 brew 来安装那些依赖包。

  • “要安装,请拖动此图标……”不会再出现了。使用 Homebrew Cask 安装 macOS 应用程序、字体和插件以及其他非开源软件。

    $ brew install --cask firefox
  • 制作一个 cask 就像创建一个配方一样简单。

    $ brew create --cask foo
    Editing /usr/local/Homebrew/Library/Taps/homebrew/hom

     

posted @ 2020-12-05 11:03  为敢技术  阅读(230)  评论(0编辑  收藏  举报