1. 安装必要的软件

安装MacPorts需要先安装X11和Xcode,Lion系统已经默认安装好了X11,在Appstore里安装Xcode即可。

下载完Xcode之后,一般路径在/Application下,可以先将其拷出来,以备后续使用:

$ cp -a /Application/Xcode.app ~/soft

2. 安装MacPort,并安装

下载地址:https://distfiles.macports.org/MacPorts/,可以直接下载Lion下的最新版:https://distfiles.macports.org/MacPorts/MacPorts-2.1.1-10.7-Lion.pkg

如果MacPort出现新版本,可以直接通过如下命令进行更新:

$ sudo port -v selfupdate

添加MacPort到环境变量,vi ~/.bash_profile

export PATH=${PATH}:/opt/local/bin:/opt/local/sbin:/opt/local/share/man

3. 比如安装bash的自动补全软件:

$ sudo port install bash-completion

Error: No valid Xcode installation is properly selected.

Error: Please use xcode-select to select an Xcode installation:

Error:     sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer # version 4.3.2

Error:     sudo xcode-select -switch /Users/zhaobinjie/soft/Xcode.app/Contents/Developer # version 4.3.2

错误解决方法,1)设置xcode-select的路径,2)安装命令行工具:

$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

You can get Xcode from the Mac App Store as a free download. From within that (in the preferences | downloads) you can download and install the command line tools.

4. MacPort常用操作

查询安装的ports

$ port -qv install

当安装新的系统时,卸载安装的ports

$ sudo port -fp uninstall --follow-dependents installed

清除所有局部的构建

$ sudo port clean all

安装必须的ports

$ sudo port install portname +variant1 +variant2 …

5. 删除MacPorts:

#原版使用MacPorts安装过的软件在/opt/local目录下,删除之前最好查看下,心里有个数.

$ sudo port -f uninstall installed
$ sudo rm -rf \
/opt/local \
/Applications/DarwinPorts \
/Applications/MacPorts \
/Library/LaunchDaemons/org.macports.* \
/Library/Receipts/DarwinPorts*.pkg \
/Library/Receipts/MacPorts*.pkg \
/Library/StartupItems/DarwinPortsStartup \
/Library/Tcl/darwinports1.0 \
/Library/Tcl/macports1.0 \
~/.macports

Reference:

http://stackoverflow.com/questions/9904326/warning-the-command-line-tools-for-xcode-dont-appear-to-be-installed-most-por

http://www.macports.org/install.php

http://hi.hiing.net/2011/06/use-homebrew-package-management.html

习惯mac . OS X 安装MacPorts的更多相关文章

  1. Xamarin+Prism开发详解四:简单Mac OS 虚拟机安装方法与Visual Studio for Mac 初体验

    Mac OS 虚拟机安装方法 最近把自己的电脑升级了一下SSD固态硬盘,总算是有容量安装Mac 虚拟机了!经过心碎的安装探索,尝试了国内外的各种安装方法,最后在youtube上找到了一个好方法. 简单 ...

  2. wget Mac OS 下安装

    wget是一个从网络上自动下载文件的自由工具,支持通过HTTP.HTTPS.FTP三个最常见的TCP/IP协议下载,并可以使用HTTP代理. 下面介绍如何在Mac OS 下安装Wget 下载最新版的 ...

  3. Mac OS X安装OpenGL

    Mac OS X安装OpenGL 安装最新的cmake brew install cmake brew upgrade cmake 安装glew brew install glew 安装GLTools ...

  4. TensorFlow 安装官方教程:Ubuntu 安装,Mac OS X 安装,Windows 安装

    从我的使用体验来看  Ubuntu 是最好的, Mac 没有显卡,后期跑大项目比较鸡肋,Windows 安装各种依赖各种坑.Ubuntu 安装 TensorFlow 方便,后面安装  TensorFl ...

  5. Mac OS X中MacPorts的安装使用备忘

    Mac下面除了用dmg.pkg来安装软件外,比较方便的还有用MacPorts来帮助你安装其他应用程序,跟BSD中的ports道理一样.MacPorts就像apt-get.yum一样,可以快速安装些软件 ...

  6. Mac OS X 安装 brew 工具!

    最早的ports管理就是BSD那种,后来出现强大的Debian,弄了个dpkg+apt! Mac OS X 最早使用比较多的工具是 MacPorts,但是现在来看这个工具有点老,不是很稳定,那我们推荐 ...

  7. 【Mac】Mac OS X 安装GNU命令行工具

    macos的很多用户都是做it相关的人,类unix系统带来了很多方面,尤其是经常和linux打交道的人. 但是作为经常使用linux 命令行的人发现macos中的命令行工具很多都是bsd工具,跟lin ...

  8. 以 MAMP 为 Mac OS X 安装并设置 PHP开发环境

    PHP 页需要通过 Web 服务器处理.因此,要在 Dreamweaver 中使用 PHP 进行开发,您需要访问支持 PHP 的 Web 服务器和 MySQL 数据库.phpMyAdmin 也很实用, ...

  9. 在Mac OS上安装Vagrant和Docker的教程

    转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/128.html?1455808640 当听到很多人在说Docker是多么多 ...

随机推荐

  1. angular_$inject

    <!DOCTYPE HTML> <html lang="zh-cn" ng-app="MainApp"> <head> &l ...

  2. JS事件学习笔记(思维导图)

    导图

  3. Objective-C Runtime(转)

    博主地址: http://yulingtianxia.com/blog/2014/11/05/objective-c-runtime/ 曾经觉得Objc特别方便上手,面对着 Cocoa 中大量 API ...

  4. 解决 pathForResource 返回 nil的问题

    点击(此处)折叠或打开 NSString* path = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@&quo ...

  5. UIScrollView和UIPageController

    实现代码: // // ViewController.m // UIpageControl // // Created by dllo on 16/3/10. // Copyright © 2016年 ...

  6. iOS边练边学--GCD的基本使用、GCD各种队列、GCD线程间通信、GCD常用函数、GCD迭代以及GCD队列组

    一.GCD的基本使用 <1>GCD简介 什么是GCD 全称是Grand Central Dispatch,可译为“牛逼的中枢调度器” 纯C语言,提供了非常多强大的函数   GCD的优势 G ...

  7. OC基础--description方法

    PS:经过之类重写description方法后,个人感觉有点像C#中的ToString();方法 一.description方法的作用:(输出所有的OC对象都用%@) 1.默认情况下(不重写descr ...

  8. 关于Jquery 操作Cookie 取值错误

    使用JQuery操作cookie时 发生取的值不正确的问题: 结果发现cookie有四个不同的属性: 名称,内容,域,路径 $.cookie('the_cookie'); // 读取 cookie $ ...

  9. 基于Bootstrap的jQuery开关按钮插件

        按钮 下载 使用方法 首先要在页面中引入依赖文件: jquery.Bootstrap.Bootstrap Switch CSS和Bootstrap Switch JS.这里用的是bootstr ...

  10. Session的异常

    既然这一天就这么废了,那就多说一些吧!其实session也是有潜在的问题的.Session销毁的三种情况: (1)超时:超过30分钟 (2)服务器非正常关闭,如果自己手动stop service而不是 ...