Macports For Mac
Pick a location to store a working copy of the MacPorts code. For this example, /opt/mports will be used, but you can put the source anywhere. This example will create /opt/mports/macports-base containing everything needed for MacPorts.
Macports For Mac
Occasionally a MacPorts developer may wish to install more than one MacPorts instance on the same host. Only one copy of MacPorts may use the default prefix /opt/local, so for additional installations use the option --prefix as shown below. It's also recommended to change the applications dir using --with-applications-dir to avoid conflicts in /Applications/MacPorts. Use --without-startupitems to automatically set startupitem_install no in the new macports.conf, which is required to avoid conflicts in /Library/LaunchAgents or /Library/LaunchDaemons.
MacPorts defaults to building for the architecture that it is running as. If you have a universal MacPorts installation on an Apple Silicon Mac, and you run it from a terminal emulator that is not a native arm64 binary, MacPorts will end up being run as x86_64, and will build ports accordingly, which can be unexpected. This can be corrected by explicitly setting build_arch arm64 in macports.conf, or by using a native terminal emulator.
I had this issue on Mountain Lion and it was actually to do with MacPorts looking at an old XCode path (I had several versions including betas installed). I ran with the -d option and checked the config.log file at /opt/local/var/macports/sources/rsync.macports.org/release/base and it reported some errors:-
Uninstalling MacPorts is a drastic step and, depending on the issue you are experiencing, you may not need to do so.If you are unsure, ask on the macports-users mailing list first.If you are sure you want to uninstall, read on.
I think package management system is good for long-term installation. Since lab members use a lot of Apple product,I wrote Macports documentation which is package management system for Mac OSX which hopefully will be useful for members who use Mac. Note that this is not an official document but probably an easy way to get start with Macports. Macports depends mostly by its community and ones who update the port. We may have to migrate our ports when Mac announce new operating system. From my experience, it is normal to have some port problem with macports when new Mac operating system, for example, when Maverick or Yosemite was announced or when new XCode version were updated. It willtake some time (a day or a week) for them to update the new port that are compatiblewith new operating system. But yeah, most ports work very well even though OS changes sincethe community is very active.
In order to install Macports. Firstly, we need to install Xcode (see also the version of Xcodeyou have is not too old) and its commandline tools, X11 and some other things first. Then, wewill install macports from the macports website (see your OS and download the right one). All available ports are on this site. Note that the port name that are related to python2.7 will be in the form of py27-... or py-... e.g. py27-ipython, py27-pandas, py27-numpy, py27-scipy, py27-scikits-lean, py27-matplotlib. The name is different from pip install.More note is to make sure that we have installed the command line in XCode. In order tocheck whether we have installed commandline tools in XCode and have Macports up-to-date, you can type as follow:
As I have seen from now selfupdate should not take that long time. If it takes too long, probablysomething was wrong such as XCode version or Macports that we have installed. Also add macports path to /.bash_profile to include macports path (i.e. emacs /.bash_profile) as follows:
After we get macports installed, there are almost 18000 ports that we can install from git, emacs, vimto video downloader like youtube-dl or music player like cmus. A lot of ports will have dependencies (we can check on the website above). When we download one port, its dependencies will come together. However, when wewant to uninstall each port, we again need to uninstall its dependencies first before uninstall it.For python27 (or python version 2.7), I have some recommendation command line as follow:
Sometimes, if you want to install developing version of the package or you want to install package thatmacports does not provide. We can use git to clone source code directly and install. Here is anexample of how to install tornado package (other packages works in similar flow).
MacPorts' Octave port includes the non-GPL METIS. To avoid license violations do not bundle Metis with Octave and then distribute to others. In order to eliminate the Metis dependency, a local portfile may be used, and edited to remove metis. A second motivation to use a local portfile is that the portfiles for the 3.4.x and 3.6.x series did not include all dependencies for the print feature. The missing dependencies are epstool, pstoedit, and transfig. A third motivation for a local portfile is to provide additional flexibility in resolving problems with creating an Octave DMG using the port mdmg ... command. For macports 2.1.3, having the xorg-libx11 as a dependency for Octave has been found to cause the port mdmg octave-local ... command to fail. The xorg-libx11 dependency may be avoided by specifying -x11+no_x11-docs as variants and by dropping the dependence to transfig (which has xpm as a dependency and xpm depends upon several xorg-* ports.
If run from a fresh macports installation (i.e. no ports have yet been installed), then this command should complete with no errors. If ports have already been installed, then errors during the execution of this command are likely and may be resolved by modifying the variant(s) of installed packages, and/or modifying the list of variants used to produce the octave-local DMG. One of Octave's dependencies, transfig, requires port xpm, which requires many xorg ports that may cause the port mdmg ... command to fail. To alleviate this problem, the transfig port can be eliminated as a run-time dependency for Octave (can the transfig portfile be modified to eliminate the xpm dependency?).
Other options for a fresh Python install are the standard installer frompython.org, or installingPython using a general OSX package management system such as homebrew or macports. Power users onOSX will likely want one of homebrew or macports on their system to installopen source software packages, but it is perfectly possible to use thesesystems with another source for your Python binary, such as Anaconda, Canopyor Python.org Python. 076b4e4f54