High Sierra Update: If you are looking for instructions on how to manually install MacPorts onto the High Sierra GM release, check here: Installing MacPorts on MacOS “High Sierra”
Update: MacPorts has released their official El Capitan installer. You should probably use it instead. 🙂
Update: Since people are ignoring my above comment, I have updated the below instructions to reflect the version changes reported by Chrisp in the comments.
Another year, another OS X update. If you are like me, you’ve weaseled a copy of the OS X 10.11 ‘El Capitan’ Gold Master installer, and you have started checking to see how much of your software is going to break if and when you install. Given the issues I’ve had in the past, MacPorts is the very first thing I test. 🙂
The first thing I noticed is that there is no El Capitan installer for MacPorts, and the Yosemite installer will not run on OS X 10.11. So, we are back to compiling it ourselves. Fortunately, this goes pretty smoothly.
The first caveat is that in addition to needing access to OS X 10.11 ‘El Capitan’ , you will need a copy of Xcode 7 (beta, RC, etc). You won’t be able to compile MacPorts for El Capitan with Xcode 6 because of changes to one or more of the header files that ship with the OS X 10.11.
The second caveat is that I did a clean install of OS X 10.11 ‘El Capitan’, so my instructions may not adequately deal with any cruft left over by previous installs. If you have an upgrade issue, please comment here and I’ll do my best to help you out and improve the instructions. You may want to follow the MacPorts uninstall instructions before starting the below steps.
- Install OS X 10.11 ‘El Capitan’
- Install Xcode 7
- Launch Xcode:
- Agree to the license.
- Let it install the extra components it says it needs.
- Quit xcode.
- Open a terminal window:
-
sudo bash
-
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
-
xcode-select --install
-
cd Desktop
-
mkdir macports
-
cd macports
-
curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.3.4.tar.gz
-
tar xzvf MacPorts-2.3.4.tar.gz
-
cd MacPorts-2.3.4
-
./configure --enable-readline
-
make && make install
-
echo 'export PATH=/opt/local/bin:/opt/local/sbin:$PATH' >> ~/.profile
-
source ~/.profile
-
port -v selfupdate
-
At this point, you should be ready to start reinstalling your ports! Wee!
If you see this error at step 4-10:
checking for Apple Foundation library... no configure: WARNING: GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library configure: error: Could not find a working Foundation implementation
It means you either have not installed Xcode 7 GM, or that you are running Xcode 7 Beta. Xcode 6 doesn’t know how to handle the changes to /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h that happened with El Capitan. The configure script is able to find the header file, but the test compile fails so it reports that the Apple Foundation library isn’t there.
If you are running Xcode Beta, you can get around this by using the following command in the shell you opened above, and then going back to step 4-10: (Thank you SadDigger for the comment on Reddit!)
xcode-select -s /Applications/Xcode-beta.app
Update 2015-09-15 11:06AM – Fixed a typo in instruction 4-3 where WordPress was converting a double-hyphen into an extended hyphen. I have also updated it to the latest version of MacPorts, so that the final just updates the ports rather than rebuilding the whole thing. Sorry about that!
Works fine with OS X upgraded from Yosemite to El Capitan GM, without uninstalling macports (2.3.3).
Step 12 is not needed. You might have to use ‘make && sudo make install’ (step 11) and ‘sudo port selfupdate’ (step 14).
Thank you!
I appreciate the feedback. Glad your upgrade worked.
Step 4-12 is needed if you are doing a clean install; you did an upgrade and so you already had the path update in place.
Steps 4-11 and 4-14: If you followed my instructions exactly, then at step 4-1 you put your self into a privileged shell, and so you do not need to run sudo before those commands. It doesn’t hurt, but it isn’t needed.
This was useful. Thank you for sharing.
I followed your instructions precisely as presented and experienced the exact expected results without an of the deviations mentioned.
Thanks for the time saving contribution,
Bob K
Why don’t you start use Homebrew?
I followed your instructions precisely as presented and experienced the exact expected results without an of the deviations mentioned.
Thanks for the time saving contribution,
Bob K
Hi,
Can you help me?
I get this error when installing port BZIP2:
—> Fetching archive for bzip2
—> Attempting to fetch bzip2-1.0.6_0.darwin_15.x86_64.tbz2 from http://lil.fr.packages.macports.org/bzip2
—> Attempting to fetch bzip2-1.0.6_0.darwin_15.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/bzip2
—> Attempting to fetch bzip2-1.0.6_0.darwin_15.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/bzip2
—> Fetching distfiles for bzip2
—> Attempting to fetch bzip2-1.0.6.tar.gz from http://lil.fr.distfiles.macports.org/bzip2
—> Verifying checksums for bzip2
—> Extracting bzip2
Error: org.macports.extract for port bzip2 returned: command execution failed
Please see the log file for port bzip2 for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/main.log
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port bzip2 failed
Log:
version:1
:debug:main bzip2 has no conflicts
:debug:main Executing org.macports.main (bzip2)
:debug:main changing euid/egid – current euid: 0 – current egid: 0
:debug:main egid changed to: 20
:debug:main euid changed to: 502
:debug:archivefetch archivefetch phase started at Sat Sep 19 10:05:02 CEST 2015
:msg:archivefetch —> Fetching archive for bzip2
:debug:archivefetch Executing org.macports.archivefetch (bzip2)
:debug:archivefetch Can’t run archivefetch on this port without elevated privileges. Escalating privileges back to root.
:debug:archivefetch euid changed to: 0. egid changed to: 0.
:debug:archivefetch changing euid/egid – current euid: 0 – current egid: 0
:debug:archivefetch egid changed to: 20
:debug:archivefetch euid changed to: 502
:info:archivefetch —> bzip2-1.0.6_0.darwin_15.x86_64.tbz2 doesn’t seem to exist in /opt/local/var/macports/incoming/verified
:msg:archivefetch —> Attempting to fetch bzip2-1.0.6_0.darwin_15.x86_64.tbz2 from http://lil.fr.packages.macports.org/bzip2
:debug:archivefetch Fetching archive failed:: The requested URL returned error: 404 Not Found
:msg:archivefetch —> Attempting to fetch bzip2-1.0.6_0.darwin_15.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/bzip2
:debug:archivefetch Fetching archive failed:: The requested URL returned error: 404 Not Found
:msg:archivefetch —> Attempting to fetch bzip2-1.0.6_0.darwin_15.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/bzip2
:debug:archivefetch Fetching archive failed:: The requested URL returned error: 404 Not Found
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:fetch fetch phase started at Sat Sep 19 10:05:07 CEST 2015
:notice:fetch —> Fetching distfiles for bzip2
:debug:fetch Can’t run fetch on this port without elevated privileges. Escalating privileges back to root.
:debug:fetch euid changed to: 0. egid changed to: 0.
:debug:fetch changing euid/egid – current euid: 0 – current egid: 0
:debug:fetch egid changed to: 20
:debug:fetch euid changed to: 502
:debug:fetch Executing org.macports.fetch (bzip2)
:info:fetch —> bzip2-1.0.6.tar.gz doesn’t seem to exist in /opt/local/var/macports/distfiles/bzip2
:notice:fetch —> Attempting to fetch bzip2-1.0.6.tar.gz from http://lil.fr.distfiles.macports.org/bzip2
:debug:fetch Privilege de-escalation not attempted as not running as root.
:debug:checksum checksum phase started at Sat Sep 19 10:05:11 CEST 2015
:notice:checksum —> Verifying checksums for bzip2
:debug:checksum Executing org.macports.checksum (bzip2)
:info:checksum —> Checksumming bzip2-1.0.6.tar.gz
:debug:checksum Calculated (md5) is 00b516f4704d4a7cb50a1d97e6e8e15b
:debug:checksum Correct (md5) checksum for bzip2-1.0.6.tar.gz
:debug:checksum Calculated (sha1) is 3f89f861209ce81a6bab1fd1998c0ef311712002
:debug:checksum Correct (sha1) checksum for bzip2-1.0.6.tar.gz
:debug:checksum Calculated (rmd160) is cc31bbae95e8eec259cef7627eae0c667654a339
:debug:checksum Correct (rmd160) checksum for bzip2-1.0.6.tar.gz
:debug:checksum Privilege de-escalation not attempted as not running as root.
:debug:extract extract phase started at Sat Sep 19 10:05:11 CEST 2015
:notice:extract —> Extracting bzip2
:debug:extract Executing org.macports.extract (bzip2)
:info:extract —> Extracting bzip2-1.0.6.tar.gz
:debug:extract setting option extract.args to ‘/opt/local/var/macports/distfiles/bzip2/bzip2-1.0.6.tar.gz’
:debug:extract Environment:
CC_PRINT_OPTIONS=’YES’
CC_PRINT_OPTIONS_FILE=’/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work/.CC_PRINT_OPTIONS’
CPATH=’/opt/local/include’
LIBRARY_PATH=’/opt/local/lib’
MACOSX_DEPLOYMENT_TARGET=’10.11′
:debug:extract Assembled command: ‘cd “/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work” && /usr/bin/gzip -dc ‘/opt/local/var/macports/distfiles/bzip2/bzip2-1.0.6.tar.gz’ | /usr/bin/gnutar -xf -‘
:debug:extract Executing command line: cd “/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work” && /usr/bin/gzip -dc ‘/opt/local/var/macports/distfiles/bzip2/bzip2-1.0.6.tar.gz’ | /usr/bin/gnutar -xf –
:info:extract dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
:info:extract Referenced from: /usr/bin/gnutar
:info:extract Reason: image not found
:info:extract gzip: error writing to output: Broken pipe
:info:extract gzip: /opt/local/var/macports/distfiles/bzip2/bzip2-1.0.6.tar.gz: uncompress failed
:info:extract sh: line 1: 39315 Done(1) /usr/bin/gzip -dc ‘/opt/local/var/macports/distfiles/bzip2/bzip2-1.0.6.tar.gz’
:info:extract 39316 Trace/BPT trap: 5 | /usr/bin/gnutar -xf –
:info:extract Command failed: cd “/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work” && /usr/bin/gzip -dc ‘/opt/local/var/macports/distfiles/bzip2/bzip2-1.0.6.tar.gz’ | /usr/bin/gnutar -xf –
:info:extract Exit code: 133
:error:extract org.macports.extract for port bzip2 returned: command execution failed
:debug:extract Error code: NONE
:debug:extract Backtrace: command execution failed
while executing
“portextract::extract_main org.macports.extract”
(“eval” body line 1)
invoked from within
“eval $procedure $targetname”
:info:extract Warning: targets not executed for bzip2: org.macports.activate org.macports.extract org.macports.patch org.macports.configure org.macports.build org.macports.destroot org.macports.install
:notice:extract Please see the log file for port bzip2 for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/main.log
This is exactly what I needed. Thanks!
I’m not doing a clean install. Maybe that’s the problem. Anyway, things went smoothly until Step 4.14, port -v self update. I get the messages:
Current platform “darwin 15” does not match expected platform “darwin 14”
Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration
OS platform mismatch
while executing
“mportinit ui_options global_options global_variations”
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch
I am running the GM of El Capitan and Xcode 7, which doesn’t appear to be a beta version.
If the only recourse is to scrub existing MacPorts, is there a way of saving the ports I already have so I don’t have to try and remember to download them again?
Thanks, slferris
Current platform “darwin 15” does not match expected platform “darwin 14”
That’s the error you get when you try to run macports components compiled for Yosemite on El Capitan. I expect you will need to clean out your old install first.
To save your old port list, and reinstall it automagically, run this command before uninstalling MacPorts:
port installed | awk '{print $1}' > /tmp/portlist.txt
And then after installing a fresh copy of MacPorts, re-install your old port list with this command:
sudo port install `cat /tmp/portlist.txt`
Never mind. I ran your procedure again and this time it worked. Not sure why. Thanks.
very helpfull
So do you have to run macports thru the command line or is there a icon that is created when you follow these steps?
I’ve never known MacPorts to install any icons. I’ve always used it command line.
Thanks for this helpful post. I forgot about MacPorts when I upgraded and it set me back a few hours to sort out this nonsense. The MacPorts project is definitely lacking elegance in this department.
The Mac App Store can be confusing sometimes. It will show an update installed, but still listed as needing to be installed. I had that problem with Xcode 7…. It showed 7.0.1 as installed, but then still needing to be installed. To be sure, I checked my local version and then saw that it was still at 7.0. So I needed whatever the App Store was offering up. Attempting to install from the Updates panel did not work. I needed to go to the Xcode details page and install from there. And it takes a long time, even though the update is only a partial (was about 106MB), just to get the differences from what I already had. Just wait for it to finish, then run the “xcode-select –install” step above.
Worked like a charm. Thanks a lot!
All goes well until the “make” command (Step 11). It runs through a whole bunch of stuff, then get an error here:
===> making all in src/pextlib1.0
clang -dynamiclib -g -O2 -std=c99 -Wextra -Wall -pedantic -Wl,-single_module Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o fs-traverse.o strcasecmp.o vercomp.o filemap.o base32cmd.o sha1cmd.o curl.o rmd160cmd.o sha256cmd.o readline.o uid.o tracelib.o tty.o readdir.o pipe.o flock.o system.o mktemp.o realpath.o -o Pextlib.dylib -L/Users/Steve/Desktop/macports/MacPorts-2.3.3/vendor/tcl8.5.15/unix -ltclstub8.5 -install_name /opt/local/libexec/macports/lib/pextlib1.0/Pextlib.dylib -lcurl -lreadline ../registry2.0/registry.dylib
Undefined symbols for architecture x86_64:
“_rl_username_completion_function”, referenced from:
_attempted_completion_function in readline.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Pextlib.dylib] Error 1
make[1]: *** [all] Error 1
make: *** [all] Error 1
Any suggestion?
Also: Thank You for the instructions! I didn’t want to do without MacPorts.
“If you see this error at step 4-10:
checking for Apple Foundation library… no
configure: WARNING: GNUSTEP_SYSTEM_ROOT
[…]
“It means you either have not installed Xcode 7 GM, or that you are running Xcode 7 Beta. ”
I’m getting this error, but I’m running the XCode 7.0.1 and getting this error. No betas, I’m on OS 10.11 and the regular release of XCode.
^^ Followup: As I am not an admin user on my computer, I prefaced your Terminal instructions with a “su admin”.
“To save your old port list, and reinstall it automagically, run this command before uninstalling MacPorts:
port installed | awk ‘{print $1}’ > /tmp/portlist.txt
”
There’s a chicken-and-egg situation here. Can’t run port until the install is complete! 😉
Thanks for this. Everything worked but when I did a
port upgrade outdated
or your alternate:
sudo port install `cat /tmp/portlist.txt`
it hangs on "Configuring gettext"
Looks like that issue has been around for a while but so far none of the posted solutions I tried have worked.
Sorry–forgot to close the “code” tag. Resubmitted post.
Thanks for this. Everything worked but when I did a
port upgrade outdated
or your alternate:
sudo port install `cat /tmp/portlist.txt`
it hangs on “Configuring gettext”
Looks like that issue has been around for a while but so far none of the posted solutions I tried have worked.
I have updated the same way as I have for the last few OS updates. Use the SVN method on the web site and it works. Takes a lot of time but works and will upgrade all your current ports.
And yes, first steps are XCode 7.0.1 and the CLI tools. Don’t forget them!
Thanks for this post – very helpful!
Thank you!! This was very helpful.
Hi,
I got this error while running “./configure –enable-readline”:
checking how to run the C preprocessor… /lib/cpp
configure: error: C preprocessor “/lib/cpp” fails sanity check
See `config.log’ for more details.
configure: error: configure failed for vendor/tcl8.5.15/unix
Any idea?
I initially tried with El capitan package. It got stuck long in Running window. So forced quit it.
Found an update in Xcode in my App store.
Updated the Xcode and continued with your steps.
Mac ports got installed but self update seems to be stuck for lone in command line.
sudo port -v selfupdate
Password:
Sorry, try again.
Password:
—> Updating MacPorts base sources using rsync
receiving file list … done
base.tar
sent 31276 bytes received 230128 bytes 12751.41 bytes/sec
total size is 27013120 speedup is 103.34
receiving file list … done
base.tar.rmd160
sent 64 bytes received 635 bytes 279.60 bytes/sec
total size is 512 speedup is 0.73
MacPorts base version 2.3.3 installed,
MacPorts base version 2.3.4 downloaded.
—> Updating the ports tree
Synchronizing local ports tree from rsync://rsync.macports.org/release/tarballs/ports.tar
receiving file list … done
ports.tar
Please help.
Ignore. I made it work.
I need to run source .profie every time. what can i do to get rid of this? anybody please help me.
How are you getting to your elevated privileges shell? Are you using ‘sudo bash’ or ‘sudo su -‘?
I followed the steps given above. But when I enter the final command i.e. “port -v selfupdate” it exits with this error:
—> Updating MacPorts base sources using rsync
rsync: failed to connect to rsync.macports.org: Connection refused (61)
rsync error: error in socket IO (code 10) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/clientserver.c(105) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv –delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
Exit code: 10
Error: Error synchronizing MacPorts sources: command execution failed
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: command execution failed
This looks like a network connectivity issue. Are you behind a very restrictive firewall, or perhaps have LittleSnitch installed?
It’s not network conn issue. I come across your article when I met same error when trying to update port.
The solution is to modify /opt/local/etc/macports/sources.conf
from original line:
rsync://rsync.macports.org/release/tarballs/ports.tar [default]
to
rsync://131.188.12.211/macports/release/tarballs/ports.tar [default]
The IP 131.188.12.211 is got from
nslookup rsync.macports.org
I got this problem when I ran the last line.
bash-3.2# port -v selfupdate
—> Updating MacPorts base sources using rsync
rsync: read error: Operation timed out (60)
rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(604) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv –delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
Exit code: 12
Error: Error synchronizing MacPorts sources: command execution failed
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: command execution failed
please help me.
This looks like a network or firewall issue. From the error, your computer is able to resolve rsync.macports.org, but the rsync is timing out.
Thank you.. its work like a charm.. do u know or familiar with octopus tddft?? I have installed it but i can run it due to these error:
bash-3.2$ cd octopus\ work/
bash-3.2$ ls
inp.txt out out.log
bash-3.2$ octopus > out.log
*** Fatal Error (description follows)
Error initializing parser
Cannot open input file!
Please provide an input file with name inp in the current workdir
thank you
by now (end of July 2016) you have to use MacPorts 2.3.4, otherwise you end up in this rsync connection error already discussed above.
Took me a while fiddling around with all kinds of proxy settings (export http_proxy=http:// as well as set RSYNC_PROXY=…) before realizing that the base.tar URI is simply outdated in the MacPorts 2.3.3 version (this does not exist any more: rsync://rsync.macports.org/release/tarballs/base.tar) By the way: thanks Apple!
Solution: In step 7 do this:
curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.3.4.tar.gz
using the equivalent version number in the following ones.
Cheers
Hi, I tried your solution but when I try to run configure I get this:
bash-3.2# ./configure –enable-readline
checking build system type… mkdir: /tmp/cg4967-13168: Operation not permitted
mkdir: /tmp/cg-4967: Operation not permitted
config.guess: cannot create a temporary directory in /tmp
configure: error: cannot guess build type; you must specify one
Do you know what the problem is?
Did you get an error when you tried step #1 “sudo bash”?
Hi Chris,
No, no problem with any step before /.configure
Perhaps I should mention that I have the coretelephony bug a lot of people is reporting. The interesting thing is that it is also related to the /tmp folder
I have also been unable to install other applications such as, Homebrew, Macports via the dmg and Xquartz
Have you tried these remedies?
http://www.macosxblog.com/how-to-fix-coretelephony-trace-file-error-on-mac/
Yes. All of them. Solution 3 was impossible to implement. The result was:
chown: /tmp: Operation not permitted
I’ve checked the permissions for /tmp and everything seems to be OK. A user in this article suggests it might be related to a new feature in El Capitan named Rootless. I’m unsure about what he suggests (to disable it temporarily).
http://superuser.com/questions/279235/why-does-chown-report-operation-not-permitted-on-os-x
Yeah, I wrote (and used) my instructions before the rootless update came out. I’m neck deep in a new job and don’t have the spare cycles to spin up a 10.11 machine, patch it up, and then work through fixing the instructions. I’m sorry. 🙁
Fixed it! I tried the solution but following the instructions on this thread. Worked like a charm. According to Apple, there’s no need to manually repair permissions in El Capitan because the system does that automatically. Not quite so.
http://superuser.com/questions/279235/why-does-chown-report-operation-not-permitted-on-os-x
Awesome! Glad you found a fix. Sorry I wasn’t much help.
Could you redo this macOS high Sierra? please and thanks
The beta site is down right now, but if I remember tonight I’ll try to download the public beta and work out the install notes.
https://www.ghostwheel.com/blog/2017/09/15/installing-macports-on-macos-high-sierra/