#40984: ncurses@5.9.2+command execution failed-build failed -----------------------+-------------------------------- Reporter: idleft@… | Owner: macports-tickets@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: invalid | Keywords: Port: ncurses | -----------------------+-------------------------------- Comment (by idleft@…): Replying to [comment:5 ryandesign@…]:
Replying to [comment:3 idleft@…]:
Yes, your concern is right. It's an old problem I have in Mountain Lion. I stupidly followed some guide, compiled and installed the coreutils into the /usr/bin. I thought the new installation of Mavericks would overwritten this problem, but it seems doesn't work, as your assumption. I checked out the utilities in /usr/bin, likie 'ls', etc. None of them working properly, and I have to add path /bin in front of /usr/bin to make these basic commands working. Is there are anything else I can do to solve this problem?
I also would have thought that upgrading to Mavericks (or reinstalling Mountain Lion) would have replaced the bad coreutils files with the correct OS X versions. You can solve it manually, but it'll take a bit of work. Here is how I'd do it.
First, take a full system backup using Time Machine or your preferred method. If you don't have a backup drive or don't have space for a full backup, at least back up /usr, e.g. using:
{{{ sudo /usr/bin/tar cjf ~/Desktop/usr-backup.tar.bz2 /usr }}}
On my system that comes to about 310MiB so hopefully you at least have room for that.
Next, identify all the files that coreutils installed into /usr/bin. We could try to use the coreutils port for this, but instead I manually untarred the coreutils source and ran:
{{{ ./configure --prefix=/tmp/coreutils make -j8 make install find /tmp/coreutils -type f | sed -e s,/tmp/coreutils,/usr, > ~/Desktop /coreutils-files.txt }}}
Then we need to figure out which of those files belong on OS X and which of them don't. Here's how I did this:
{{{ xargs ls -1 < ~/Desktop/coreutils-files.txt > ~/Desktop/coreutils-files- ls.txt 2>&1 }}}
I've attached the resulting files for reference. In the second file, all of those lines that say "No such file or directory" don't belong on OS X and should be removed. Here's how I generated a script to do that:
{{{ sed -E -n -e 's,^ls: (.*): .*$,rm -fv '\''\1'\'',p' < ~/Desktop /coreutils-files-ls.txt > ~/Desktop/coreutils-remove.sh }}}
This script is attached and if it looks good to you, you can download it to your Desktop and run it with:
{{{ sudo sh ~/Desktop/coreutils-remove.sh }}}
The rest of the coreutils files need to be restored to their original OS X versions. This is the tricky part, if you don't have a backup.
Assuming you don't have /Applications/Install OS X Mavericks.app anymore (it gets removed after installing OS X), download it again from the Mac App Store. Then mount the image inside it:
{{{ open '/Applications/Install OS X Mavericks.app/Contents/SharedSupport/InstallESD.dmg' }}}
Now open the Packages folder. Here it gets a bit messy, because the files you need aren't all in the same package. If you're not sure which package a particular file came from, you can look it up in the bills of materials (BOMs) that the installer leaves on your drive. There may be a better way to do this, but I used this command to create a single file containing all the Apple BOMs:
{{{ find /private/var/db/receipts -name 'com.apple.pkg.*.bom' -print0 | xargs -0 -n 1 -I % sh -c 'lsbom -s % | sed "s,^,%: ,";' | tee ~/Desktop /all-boms.txt }}}
We can then `grep` this for files of interest. For example, to `grep` this file for all the coreutils files:
{{{ while read LINE; do grep " \.$LINE$" ~/Desktop/all-boms.txt; done < ~/Desktop/coreutils-files.txt | tee ~/Desktop/bom-results.txt }}}
all-boms.txt is about 225 MiB on my system so it takes awhile to `grep`, but after awhile it's done and we can sort it to get the list of files ordered by the package they're in:
{{{ sort -u < ~/Desktop/bom-results.txt > ~/Desktop/bom-results-sorted.txt }}}
Looks like the files are spread between BSD, BaseSystemBinaries and Essentials. You can open these packages from the install volume with [http://www.charlessoft.com/ Pacifist] and extract individual files from them. (There are also commands for doing that on the command line but I don't remember them off hand.)
Thank you so much. Your generous help and detailed solution solved my problem. Firstly, I followed your instruction step by step, and finally I understood that I should use your result since my /usr is full of coreutil files. I use the pacifit to extract the files from pkg, and use rsync copied files to the target directory. Now it's all works perfectly. Thank you very much ~~ -- Ticket URL: <https://trac.macports.org/ticket/40984#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X