Mac OS X 中 MacPorts 安装和使用
MacPorts 是开源社区发起的一项方便开发者在 Shell 下进行软件的编译、安装和升级等操作的开源项目,旨在方便 Mac 环境下的开发者。不光是开发者,普通用户有时候也会用到 MacPorts ,比如说你需要安装一些开源软件。MAC 端常用的软件安装方式是通过 DMG 或者 PKG 包来安装,你可以把 MacPorts 看作另外一种方式。Mac下面除了用dmg、pkg来安装软件外,比较方便的还有用MacPorts来帮助你安装其他应用程序,跟BSD中的ports道理一样。MacPorts就像apt-get、yum一样,可以快速安装些软件。
MacPorts 官网: https://www.macports.org/install.php
Mac 系统版本
macOS Sierra
版本 10.12.3
MacPorts 提供有dmg安装和源码安装两种方式
通过pkg 安装 MacPorts
wget https://github.com/macports/macports-base/releases/download/v2.4.1/MacPorts-2.4.1-10.12-Sierra.pkg
通过Source 安装 MacPorts
wget https://github.com/macports/macports-base/releases/download/v2.4.1/MacPorts-2.4.1.tar.gz
tar zxvf MacPorts-2.4.1.tar.gz
cd MacPorts-2.4.1
./configure && make && sudo make install
cd ../
rm -rf MacPorts-2.4.1*
然后将 /opt/local/bin 和 /opt/local/sbin 添加到$PATH搜索路径中
编辑/etc/profile文件中,加上
vim /etc/profile
export PATH=/opt/local/bin:$PATH
export PATH=/opt/local/sbin:$PATH
MacPorts 使用
更新ports tree和MacPorts版本,强烈推荐第一次运行的时候使用-v参数,显示详细的更新过程。
sudo port -v selfupdate
搜索索引中的软件
sudo port search name
安装新软件
sudo port install name
卸载软件
sudo port uninstall name
查看有更新的软件以及版本
port outdated
升级可以更新的软件
sudo port upgrade outdated
Eclipse的插件需要subclipse需要JavaHL,下面通过MacPorts来安装
sudo port install subversion-javahlbindings
MacPorts 安装软件的实例
wget是一个从网络上自动下载文件的自由工具,支持通过HTTP、HTTPS、FTP三个最常见的TCP/IP协议下载,并可以使用HTTP代理。wget名称的由来是“World Wide Web”与“get”的结合。
MacPorts 安装 wget:
sudo port install wget
MacPorts 安装 putty:
sudo port install putty
错误提示
$ putty
(putty:20988): Gtk-WARNING **: cannot open display:
$ sudo port install putty
Password:
Warning: xcodebuild exists but failed to execute
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
---> Computing dependencies for putty
---> Cleaning putty
---> Scanning binaries for linking errors
---> No broken files found.
需要安装 Xcode 和 XQuartz,解决步骤:
1)安装 Xcode
https://itunes.apple.com/cn/app/xcode/id497799835?mt=12
如上图,点击“在Mac App Store中查看”,进入 App Store 中安装 Xcode,如下图:
2)安装 XQuartz
XQuartz官网: https://www.xquartz.org
The XQuartz project is an open-source effort to develop a version of the X.Org X Window System that runs on OS X. Together with supporting libraries and applications, it forms the X11.app that Apple shipped with OS X versions 10.5 through 10.7.
License Info
An XQuartz installation consists of many individual pieces of software which have various licenses. The X.Org software components’ licenses are discussed on the X.Org Foundation Licenses page. The quartz-wm window manager included with the XQuartz distribution uses the Apple Public Source License Version 2.
Error: Gtk-WARNING **: cannot open display:
If you get the above warning, please make sure you are using XQuartz as your X11 Emulator. Then go ahead and either restart Mac or simply log out and log back in. That should resolve the issue.
3)重启Mac后,控制台输入putty,成功打开putty
详见解决方法:Installing and Using Putty on Mac (OS X)
参考推荐:
Installing and Using Putty on Mac (OS X)
Mac brew 安装软件(推荐)
版权所有: 本文系米扑博客原创、转载、摘录,或修订后发表,最后更新于 2017-08-02 01:56:32
侵权处理: 本个人博客,不盈利,若侵犯了您的作品权,请联系博主删除,莫恶意,索钱财,感谢!