You need to update the command line tools Xcode installs. For whatever reason, Xcode doesn't seem to want to update them itself, but you can force it by running xcode-select --install
. This will pop open a GUI prompt; select "Install" and let the installer do its thing. After this, MacPorts should build itself successfully. (You may need to rehash first; rehash
in tcsh, hash -r
in bash and zsh (I think).)
I see a few issues from what you posted.
error: unable to unlink old 'Library/Homebrew/test/mach/a.out' (Permission denied)
It seems to me you have a permissions issue perhaps from the leftover previous installation of Homebrew. You should remove all traces of the previous installation before you reinstall.
And Homebrew doesn't want to be installed as root
Why on earth would you want to install homebrew as root? The whole point of the project is to keep homebrew in /usr/local
so that you don't need sudo.
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew.
You should also ensure MacPorts is uninstalled and that you've uninstalled Fink. They could cause issues with software installed by homebrew.
Warning: An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
This indicates to me that you still have an old version of Git in your PATH, probably installed with another package manager. OS X Mavericks comes with Git version 1.8.5.1
What is the result of the whereis git
command from the Terminal? usr/bin/git
is the OS X install of Git.
Follow the guides to completely remove previous MacPorts or Fink installs and ensure the old directories are removed from your PATH variable.
PS.
I'll be sad if I can't use Mac OS X as a hacker's Unix
That would make me sad too. :(
I find homebrew invaluable and easy to work with. In summary, it seems you just have old software installed (and perhaps extraneous directories in your PATH) and need to clear it out, check your permissions, and reinstall homebrew from scratch.
Best Answer
Although System Integrity Protection will prohibit even the superuser from modifying system files,
opt
isn't included in that list. The issue is that all applications are fenced off from "important" bits of the filesystem by default andTerminal.app
is no exception. In Mojave (OS X 10.14):Terminal.app
Screenshots are available in http://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/.
You'll need to restart Terminal for the changes to take effect. The MacPorts uninstall command at https://guide.macports.org/chunked/installing.macports.uninstalling.html - at the time of writing, this:
...should now work.
As a side-note, current versions of iTerm request this permission when first installed and run, so if you have iTerm kicking around and don't want to restart Terminal, add it to the "Full Disk Access" list (if it isn't added already) and run the command there.