设为首页 收藏本站
查看: 879|回复: 0

[经验分享] Mac上一定要安装的——MacPorts

[复制链接]

尚未签到

发表于 2016-5-18 07:10:13 | 显示全部楼层 |阅读模式
  
如果你习惯了使用linux里边的apt-get,那么你一定要在你的mac里安装MacPorts。以下是转载过来的关于这个软件的简介和安装步骤:

MacPorts简介
MacPorts,曾经叫做DarwinPorts,是一个软件包管理系统,用来简化Mac OS X和Darwin操作系统上软件的安装。它是一个用来简化自由软件/开放源代码软件的安装的自由/开放源代码项目,与Fink和BSD类ports套件的目标和功能类似。跟BSD中的ports道理一样。MacPorts就像apt-get、yum一样,可以快速安装些软件。
MacPorts下载与安装
一.通过(.pkg)安装: Mac OS X Package (.pkg) Installer
访问官方网站: http://www.macports.org/install.php
http://distfiles.macports.org/MacPorts/MacPorts-2.1.1-10.7-Lion.pkg
二.通过(Source)安装MacPorts:Source Installation
1.cd到Downloads/目录下wget下载 MacPorts-2.1.1.tar.gz
输入: wget https://distfiles.macports.org/MacPorts/MacPorts-2.1.1.tar.gz

2.解压 MacPorts-2.1.1.tar.gz 输入: tar zxvf MacPorts-2.1.1.tar.gz (tar jxvf MacPorts2.1.1.tar.bz2)

3.cd到解压到的目录MacPorts-2.1.1输入: ./configure && make && sudo make install 安装

中间提示输入密码完成安装!

7.然后将/opt/local/bin和/opt/local/sbin添加到$PATH搜索路径中
编辑/etc/profile文件 $ sudo vim /etc/profile (特许编辑,强制保存退出 wq!)文件最后加上下面两句


1
2

[color=#800080 !important]export [color=#000000 !important]PATH[color=#006fe0 !important]=[color=#006fe0 !important]/[color=#000000 !important]opt[color=#006fe0 !important]/[color=#000000 !important]local[color=#006fe0 !important]/[color=#000000 !important]bin[color=#006fe0 !important]:[color=#333333 !important]$[color=#800080 !important]PATH
[color=#800080 !important]export [color=#000000 !important]PATH[color=#006fe0 !important]=[color=#006fe0 !important]/[color=#000000 !important]opt[color=#006fe0 !important]/[color=#000000 !important]local[color=#006fe0 !important]/[color=#000000 !important]sbin[color=#006fe0 !important]:[color=#333333 !important]$[color=#000000 !important]PATH



 
MacPorts使用
1.Mac Port中第三方软件下载包存放的默认路径是:/opt/local/var/macports/distfiles/
为了提高安装速度,可以在安装新port时直接将此目录下的文件拷贝到新的Mac Port相同的目录中就可以避免Port去网上下载。

2.使用Mac Port前应该首先更新Port的index
输入: $ sudo port -v selfupdate (强烈推荐第一次运行的时候使用-v参数,显示详细的更新过程)

3.查看Mac Port中当前可用的软件包及其版本 输入: $ port list

4.查看有更新的软件以及版本 输入: $ port outdated

5.升级可以更新的软件 输入: $ sudo port upgrade outdated

6.在Mac Port搜索需要安装的软件包 输入: $ port search maven

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

[color=#000000 !important]HuiMinmatoMacBook[color=#006fe0 !important]-[color=#000000 !important]Pro[color=#006fe0 !important]:[color=#800080 !important]Downloads [color=#000000 !important]zikercn[color=#333333 !important]$[color=#006fe0 !important] [color=#800080 !important]port [color=#800080 !important]search [color=#800080 !important]maven
[color=#000000 !important]maven[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]1.0.2[color=#006fe0 !important] [color=#333333 !important]([color=#000000 !important]java[color=#333333 !important],[color=#006fe0 !important] [color=#000000 !important]devel[color=#333333 !important])
[color=#006fe0 !important]    [color=#800080 !important]stub [color=#000000 !important]port[color=#333333 !important],[color=#006fe0 !important] [color=#800080 !important]use [color=#800080 !important]maven1 [color=#800080 !important]instead

[color=#000000 !important]maven[color=#006fe0 !important]-[color=#000000 !important]ant[color=#006fe0 !important]-[color=#000000 !important]tasks[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]2.1.3[color=#006fe0 !important] [color=#333333 !important]([color=#000000 !important]devel[color=#333333 !important],[color=#006fe0 !important] [color=#000000 !important]java[color=#333333 !important])
[color=#006fe0 !important]    [color=#800080 !important]Use [color=#800080 !important]many [color=#800080 !important]of [color=#000000 !important]Maven'[color=#000000 !important]s[color=#006fe0 !important] [color=#800080 !important]artifact [color=#800080 !important]handling [color=#800080 !important]features [color=#800080 !important]from [color=#000000 !important]Ant[color=#333333 !important].

[color=#000000 !important]maven1[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]1.1[color=#006fe0 !important] [color=#333333 !important]([color=#000000 !important]java[color=#333333 !important],[color=#006fe0 !important] [color=#000000 !important]devel[color=#333333 !important])
[color=#006fe0 !important]    [color=#000000 !important]A[color=#006fe0 !important] [color=#000000 !important]java[color=#006fe0 !important]-[color=#800080 !important]based [color=#800080 !important]build [color=#800080 !important]and [color=#800080 !important]project [color=#800080 !important]management [color=#000000 !important]environment[color=#333333 !important].

[color=#000000 !important]maven2[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]2.2.1[color=#006fe0 !important] [color=#333333 !important]([color=#000000 !important]java[color=#333333 !important],[color=#006fe0 !important] [color=#000000 !important]devel[color=#333333 !important])
[color=#006fe0 !important]    [color=#000000 !important]A[color=#006fe0 !important] [color=#000000 !important]java[color=#006fe0 !important]-[color=#800080 !important]based [color=#800080 !important]build [color=#800080 !important]and [color=#800080 !important]project [color=#800080 !important]management [color=#000000 !important]environment[color=#333333 !important].

[color=#000000 !important]maven3[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]3.0.4[color=#006fe0 !important] [color=#333333 !important]([color=#000000 !important]java[color=#333333 !important],[color=#006fe0 !important] [color=#000000 !important]devel[color=#333333 !important])
[color=#006fe0 !important]    [color=#000000 !important]A[color=#006fe0 !important] [color=#000000 !important]java[color=#006fe0 !important]-[color=#800080 !important]based [color=#800080 !important]build [color=#800080 !important]and [color=#800080 !important]project [color=#800080 !important]management [color=#000000 !important]environment[color=#333333 !important].

[color=#000000 !important]maven_select[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]0.3[color=#006fe0 !important] [color=#333333 !important]([color=#000000 !important]sysutils[color=#333333 !important])
[color=#006fe0 !important]    [color=#800080 !important]common [color=#800080 !important]files [color=#800080 !important]for [color=#800080 !important]selecting [color=#800080 !important]default [color=#800080 !important]Maven [color=#800080 !important]version

[color=#000000 !important]Found[color=#006fe0 !important] [color=#ce0000 !important]6[color=#006fe0 !important] [color=#000000 !important]ports[color=#333333 !important].



7.搜索到需要安装的软件包之后,如何查看具体的软件包的内容和说明
输入: $ port info maven3


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

[color=#000000 !important]maven3[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]3.0.4[color=#006fe0 !important] [color=#333333 !important]([color=#000000 !important]java[color=#333333 !important],[color=#006fe0 !important] [color=#800080 !important]devel[color=#333333 !important])

[color=#000000 !important]Description[color=#006fe0 !important]:[color=#006fe0 !important]          [color=#800080 !important]Maven [color=#000000 !important]is[color=#006fe0 !important] [color=#000000 !important]a[color=#006fe0 !important] [color=#800080 !important]Java [color=#800080 !important]project [color=#800080 !important]management [color=#800080 !important]and [color=#800080 !important]project
[color=#800080 !important]                      [color=#800080 !important]comprehension [color=#000000 !important]tool[color=#333333 !important].[color=#006fe0 !important] [color=#800080 !important]Maven [color=#800080 !important]is [color=#800080 !important]based [color=#800080 !important]on [color=#800080 !important]the [color=#800080 !important]concept [color=#000000 !important]of[color=#006fe0 !important] [color=#000000 !important]a
[color=#006fe0 !important]                      [color=#800080 !important]project [color=#800080 !important]object [color=#004ed0 !important]model[color=#006fe0 !important] [color=#333333 !important]([color=#000000 !important]POM[color=#333333 !important])[color=#006fe0 !important] [color=#800080 !important]in [color=#800080 !important]that [color=#800080 !important]all [color=#800080 !important]the [color=#800080 !important]artifacts
[color=#800080 !important]                      [color=#800080 !important]produced [color=#800080 !important]by [color=#800080 !important]Maven [color=#000000 !important]are[color=#006fe0 !important] [color=#000000 !important]a[color=#006fe0 !important] [color=#800080 !important]result [color=#800080 !important]of [color=#000000 !important]consulting[color=#006fe0 !important] [color=#000000 !important]a[color=#006fe0 !important] [color=#800080 !important]well
[color=#800080 !important]                      [color=#800080 !important]defined [color=#800080 !important]model [color=#800080 !important]for [color=#800080 !important]your [color=#000000 !important]project[color=#333333 !important].[color=#002d7a !important]Builds[color=#333333 !important],[color=#006fe0 !important] [color=#000000 !important]documentation[color=#333333 !important],
[color=#006fe0 !important]                      [color=#800080 !important]source [color=#000000 !important]metrics[color=#333333 !important],[color=#006fe0 !important] [color=#800080 !important]and [color=#800080 !important]source [color=#000000 !important]cross[color=#006fe0 !important]-[color=#800080 !important]references [color=#800080 !important]are [color=#800080 !important]all
[color=#800080 !important]                      [color=#800080 !important]controlled [color=#800080 !important]by [color=#800080 !important]your [color=#000000 !important]POM[color=#333333 !important].[color=#006fe0 !important] [color=#000000 !important]Maven[color=#006fe0 !important] [color=#ce0000 !important]3[color=#006fe0 !important] [color=#800080 !important]aims [color=#800080 !important]to [color=#800080 !important]ensure [color=#800080 !important]backward
[color=#800080 !important]                      [color=#800080 !important]compatibility [color=#800080 !important]with [color=#000000 !important]Maven[color=#006fe0 !important] [color=#ce0000 !important]2[color=#333333 !important],[color=#006fe0 !important] [color=#800080 !important]improve [color=#000000 !important]usability[color=#333333 !important],[color=#006fe0 !important] [color=#800080 !important]increase
[color=#800080 !important]                      [color=#000000 !important]performance[color=#333333 !important],[color=#006fe0 !important] [color=#800080 !important]allow [color=#800080 !important]safe [color=#000000 !important]embedding[color=#333333 !important],[color=#006fe0 !important] [color=#800080 !important]and [color=#800080 !important]pave [color=#800080 !important]the [color=#800080 !important]way [color=#800080 !important]to
[color=#800080 !important]                      [color=#800080 !important]implement [color=#800080 !important]many [color=#800080 !important]highly [color=#800080 !important]demanded [color=#000000 !important]features[color=#333333 !important].
[color=#000000 !important]Homepage[color=#006fe0 !important]:[color=#006fe0 !important]             [color=#000000 !important]http[color=#006fe0 !important]:[color=#ff8000 !important]//maven.apache.org/

[color=#000000 !important]Build[color=#006fe0 !important] [color=#000000 !important]Dependencies[color=#006fe0 !important]:[color=#006fe0 !important]   [color=#800080 !important]kaffe
[color=#000000 !important]Runtime[color=#006fe0 !important] [color=#000000 !important]Dependencies[color=#006fe0 !important]:[color=#006fe0 !important] [color=#000000 !important]maven_select
[color=#000000 !important]Platforms[color=#006fe0 !important]:[color=#006fe0 !important]            [color=#000000 !important]darwin
[color=#000000 !important]License[color=#006fe0 !important]:[color=#006fe0 !important]              [color=#000000 !important]unknown
[color=#000000 !important]Maintainers[color=#006fe0 !important]:[color=#006fe0 !important]          [color=#000000 !important]blair[color=#333333 !important]@[color=#000000 !important]macports[color=#333333 !important].[color=#002d7a !important]org[color=#333333 !important],[color=#006fe0 !important] [color=#000000 !important]gk5885[color=#333333 !important]@[color=#000000 !important]kickstyle[color=#333333 !important].[color=#002d7a !important]net



8.查看即将安装的或者已经安装的软件包的依赖关系
输入: $ port deps maven3


1
2
3

[color=#000000 !important]Full[color=#006fe0 !important] [color=#000000 !important]Name[color=#006fe0 !important]:[color=#006fe0 !important] [color=#000000 !important]maven3[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]3.0.4_0
[color=#000000 !important]Build[color=#006fe0 !important] [color=#000000 !important]Dependencies[color=#006fe0 !important]:[color=#006fe0 !important]   [color=#800080 !important]kaffe
[color=#000000 !important]Runtime[color=#006fe0 !important] [color=#000000 !important]Dependencies[color=#006fe0 !important]:[color=#006fe0 !important] [color=#000000 !important]maven_select



9. 查看安装时允许客户定制的参数 输入: $ port variants maven3

1

[color=#800080 !important]maven3 [color=#800080 !important]has [color=#800080 !important]no [color=#000000 !important]variants



10.查看了软件包的内容和说明,并确认确实要安装,则输入: $ sudo port install maven3

1
2
3
4
5
6
7

[color=#800080 !important]To [color=#800080 !important]make [color=#000000 !important]maven[color=#006fe0 !important] [color=#ce0000 !important]3.0.4[color=#006fe0 !important] [color=#800080 !important]the [color=#800080 !important]default[color=#333333 !important],[color=#006fe0 !important] [color=#800080 !important]please [color=#800080 !important]run
[color=#800080 !important]    [color=#800080 !important]sudo [color=#800080 !important]port [color=#000000 !important]select[color=#006fe0 !important] [color=#006fe0 !important]--[color=#800080 !important]set [color=#800080 !important]maven [color=#000000 !important]maven3

[color=#006fe0 !important]--[color=#006fe0 !important]-[color=#006fe0 !important]&[color=#000000 !important]gt[color=#333333 !important];[color=#006fe0 !important]  [color=#800080 !important]Cleaning [color=#000000 !important]maven3
[color=#006fe0 !important]--[color=#006fe0 !important]-[color=#006fe0 !important]&[color=#000000 !important]gt[color=#333333 !important];[color=#006fe0 !important]  [color=#800080 !important]Updating [color=#800080 !important]database [color=#000000 !important]of[color=#006fe0 !important] [color=#004ed0 !important]binaries[color=#006fe0 !important]:[color=#006fe0 !important] [color=#ce0000 !important]100.0[color=#006fe0 !important]%
[color=#006fe0 !important]--[color=#006fe0 !important]-[color=#006fe0 !important]&[color=#000000 !important]gt[color=#333333 !important];[color=#006fe0 !important]  [color=#800080 !important]Scanning [color=#800080 !important]binaries [color=#800080 !important]for [color=#000000 !important]linking[color=#006fe0 !important] [color=#004ed0 !important]errors[color=#006fe0 !important]:[color=#006fe0 !important] [color=#ce0000 !important]100.0[color=#006fe0 !important]%
[color=#006fe0 !important]--[color=#006fe0 !important]-[color=#006fe0 !important]&[color=#000000 !important]gt[color=#333333 !important];[color=#006fe0 !important]  [color=#800080 !important]No [color=#800080 !important]broken [color=#800080 !important]files [color=#000000 !important]found[color=#333333 !important].



11. 卸载已经用Mac Port安装的软件 输入: $ sudo port uninstall maven3

1
2
3
4

[color=#006fe0 !important]--[color=#006fe0 !important]-[color=#006fe0 !important]&[color=#000000 !important]gt[color=#333333 !important];[color=#006fe0 !important]  [color=#800080 !important]Deactivating [color=#000000 !important]maven3[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]3.0.4_0
[color=#006fe0 !important]--[color=#006fe0 !important]-[color=#006fe0 !important]&[color=#000000 !important]gt[color=#333333 !important];[color=#006fe0 !important]  [color=#800080 !important]Cleaning [color=#000000 !important]maven3
[color=#006fe0 !important]--[color=#006fe0 !important]-[color=#006fe0 !important]&[color=#000000 !important]gt[color=#333333 !important];[color=#006fe0 !important]  [color=#800080 !important]Uninstalling [color=#000000 !important]maven3[color=#006fe0 !important] [color=#333333 !important]@[color=#ce0000 !important]3.0.4_0
[color=#006fe0 !important]--[color=#006fe0 !important]-[color=#006fe0 !important]&[color=#000000 !important]gt[color=#333333 !important];[color=#006fe0 !important]  [color=#800080 !important]Cleaning [color=#000000 !important]maven3



 
MacPorts卸载删除
1.卸载原有的MacPorts(如果你没有安装,直接跳过这一步,输入: $ port version 查看)
#原版使用MacPorts安装过的软件在/opt/local目录下,删除之前最好查看下,心里有个数.


1
2
3
4
5
6
7
8
9
10
11
12

[color=#800080 !important]sudo [color=#000000 !important]port[color=#006fe0 !important] [color=#006fe0 !important]-[color=#000000 !important]f[color=#006fe0 !important] [color=#800080 !important]uninstall [color=#800080 !important]installed
[color=#800080 !important]sudo [color=#000000 !important]rm[color=#006fe0 !important] [color=#006fe0 !important]-[color=#000000 !important]rf[color=#006fe0 !important]  [color=#333333 !important][[color=#006fe0 !important]/加下面的每条[color=#333333 !important]]
[color=#006fe0 !important]/[color=#000000 !important]opt[color=#006fe0 !important]/[color=#000000 !important]local[color=#006fe0 !important]
[color=#006fe0 !important]/[color=#000000 !important]Applications[color=#006fe0 !important]/[color=#000000 !important]DarwinPorts[color=#006fe0 !important]
[color=#006fe0 !important]/[color=#000000 !important]Applications[color=#006fe0 !important]/[color=#000000 !important]MacPorts[color=#006fe0 !important]
[color=#006fe0 !important]/[color=#000000 !important]Library[color=#006fe0 !important]/[color=#000000 !important]LaunchDaemons[color=#006fe0 !important]/[color=#000000 !important]org[color=#333333 !important].[color=#002d7a !important]macports[color=#333333 !important].[color=#006fe0 !important]*[color=#006fe0 !important]
[color=#006fe0 !important]/[color=#000000 !important]Library[color=#006fe0 !important]/[color=#000000 !important]Receipts[color=#006fe0 !important]/[color=#800080 !important]DarwinPorts[color=#006fe0 !important]*[color=#333333 !important].[color=#002d7a !important]pkg[color=#006fe0 !important]
[color=#006fe0 !important]/[color=#000000 !important]Library[color=#006fe0 !important]/[color=#000000 !important]Receipts[color=#006fe0 !important]/[color=#800080 !important]MacPorts[color=#006fe0 !important]*[color=#333333 !important].[color=#002d7a !important]pkg[color=#006fe0 !important]
[color=#006fe0 !important]/[color=#000000 !important]Library[color=#006fe0 !important]/[color=#000000 !important]StartupItems[color=#006fe0 !important]/[color=#000000 !important]DarwinPortsStartup[color=#006fe0 !important]
[color=#006fe0 !important]/[color=#000000 !important]Library[color=#006fe0 !important]/[color=#000000 !important]Tcl[color=#006fe0 !important]/[color=#000000 !important]darwinports1[color=#333333 !important].[color=#ce0000 !important]0[color=#006fe0 !important]
[color=#006fe0 !important]/[color=#000000 !important]Library[color=#006fe0 !important]/[color=#000000 !important]Tcl[color=#006fe0 !important]/[color=#000000 !important]macports1[color=#333333 !important].[color=#ce0000 !important]0[color=#006fe0 !important]
[color=#006fe0 !important]~[color=#006fe0 !important]/[color=#333333 !important].[color=#002d7a !important]macports



安装过程中你可能会遇到和我一样的问题:mac ports安装软件提示” Warning: xcodebuild exists but failed to execute”。
此文大部分内容转自:http://www.zikercn.com/node/8

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-218359-1-1.html 上篇帖子: Phthon十四、Python标准库(sys和os)简介 下篇帖子: java 不同操作系统获取MAC地址方法详解
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表