HOME

MacPorts 使用笔记

Table of Contents

1 TODO 特性 (Features)

  • 变种 (Variants)、任意版本
  • 系统可以同时安装多个版本,而只用其中的一个
  • 从 Binary 或 Source 安装
  • 默认使用镜像

2 常用操作 (Common Tasks)

MacPorts 的主要入口是 port(1) ,这个命令比较复杂,并不好用,好在作为普通用户,只需熟悉常用的操作。

2.1 安装 (install)

sudo port install wget

不使用默认的变种 (Variants),自定义变种

port emacs-mac-app +imagemagick +rsvg

2.2 查看包的信息 (info)

2.2.1 查看简介

port info wget
wget @1.19.1 (net, www)
Variants:             [+]ssl, test, universal

Description:          GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without Xsupport, etc.
Homepage:             http://www.gnu.org/software/wget/

Extract Dependencies: xz
Build Dependencies:   texinfo, perl5.24, pkgconfig
Library Dependencies: libidn, gettext, nettle, pcre, gnutls
Platforms:            darwin, freebsd
License:              GPL-3+
Maintainers:          Email: ryandesign@macports.org
Policy: openmaintainer

2.2.2 查看变种 (variants)

port variants wget
wget has the variants:
[+]ssl: Build with SSL support using GnuTLS
   test: Add dependencies needed to run tests
   universal: Build for multiple architectures

2.2.3 查看依赖

  1. 查看安装包 XXX 所需要的依赖
    port deps emacs-mac-app +imagemagick +rsvg
    
    Full Name: emacs-mac-app @6.1_2+imagemagick+rsvg
    Build Dependencies:   autoconf, automake, libtool
    Library Dependencies: ncurses, libxml2, gnutls, dbus, librsvg, ImageMagick
    

    以递归的方式查看依赖(“依赖的依赖”)

    port rdeps wget
    
  2. 在已安装的包中,查看哪些包依赖于包 XXX
    port dependents pcre
    
    git depends on pcre
    glib2 depends on pcre
    grep depends on pcre
    nginx depends on pcre
    privoxy depends on pcre
    the_silver_searcher depends on pcre
    wget depends on pcre
    zsh depends on pcre
    

    以递归的方式查看(如 git 依赖于 pcre,所有依赖于 git 的包也自然而然的依赖宇 pcre)

    port rdependents pcre
    

2.2.4 访问主页

port gohome wget

2.2.5 TODO 查看已安装包的文件 (contents)

2.2.6 TODO 查看文件是由哪个包提供的 (provides)

2.2.7 查看包的提示

有少量包有使用提示的,这是由用 MacPorts 打包的作者提供的。在安装结束时也会自动显示。

port notes nginx
nginx has the following notes:
A set of sample configuration files has been installed in /opt/local/share/nginx/examples.

Additionally, the files nginx.conf, mime.types, fastcgi.conf have been copied to /opt/local/etc/nginx if they didn't exist yet.
Adjust these files to your needs before starting nginx.

2.3 查看包有没有已经被安装 (installed)

port installed git
The following ports are currently installed:
  git @2.11.1_0+credential_osxkeychain+doc+pcre+perl5_24
  git @2.12.0_0+credential_osxkeychain+doc+pcre+perl5_24 (active)
port installed vim
None of the specified ports are installed.

2.4 查找 (search)

port search pat 用正则表达式匹配名称和描述

port search vim

port installed pat 用 glob 匹配名称

port installed '*py*'

port info name:pat 用正则表达式匹配名称

port info name:vim

值得注意的是 glob 是完全匹配,但正则表达式只需要匹配一部分,比如 RegExp vim 对应 Glob *vim* ,匹配所有包含 vim 的包。

2.5 TODO 升级

2.6 TODO 删除

2.7 TODO 清理

3 参考链接

Created: 2017-03-12 | Modified: 2017-03-21 | Org source | History

Author: Chunyang Xu <mail@xuchunyang.me>

Proudly Powered by Emacs & Org mode

Validate XHTML 1.0