Remove deleted/corrupt package(s) from pkgutil index?

Hi,


I'm running ML on a system, and I get complains about an old installation of XQuartz, but this version, or actually any version of XQuartz doesn't exist on the system. I get this message from brew:


$ brew doctor


Warning: Your XQuartz (2.6.4) is outdated

Please install XQuartz 2.7.7:


https://xquartz.macosforge.org


However there are some traces of an old X11 package, digging a little with pkgutil etc. shows traces of a old package:


$ pkgutil --pkgs | egrep -i "x11|XQuartz"

org.x.x11.pkg


$ pkgutil --pkg-info org.x.x11.pkg

package-id: org.x.x11.pkg

version: (null)

volume: /

location: (null)

install-time: 1221163667


…but only "general" directories are left on the system, no files AFAICT:


$ for i in `pkgutil --files org.x.x11.pkg`;do ls -ld /$i 2>/dev/null; done

drwxrwxr-x+ 217 root admin 7378 Jan 10 01:47 /Applications

drwxrwxr-x+ 35 root admin 1190 Jan 14 11:13 /Applications/Utilities

drwxr-xr-x+ 4 root wheel 136 Jun 26 2014 /System

drwxr-xr-x 75 root wheel 2550 Jun 26 2014 /System/Library

drwxr-xr-x 148 root wheel 5032 Jan 5 19:10 /System/Library/LaunchAgents

drwxr-xr-x 239 root wheel 8126 Jan 6 23:17 /System/Library/LaunchDaemons

drwxr-xr-x@ 8 root wheel 272 Dec 19 14:35 /private

drwxr-xr-x 118 root wheel 4012 Jan 14 10:47 /private/etc

drwxr-xr-x 3 root wheel 102 Jan 14 11:13 /private/etc/manpaths.d

drwxr-xr-x 3 root wheel 102 Jan 14 11:13 /private/etc/paths.d

drwxr-xr-x@ 10 root wheel 340 Jan 14 11:22 /usr

drwxr-xr-x 1070 root wheel 36380 Jan 6 23:17 /usr/bin

drwxr-xr-x 281 root wheel 9554 Jan 14 11:33 /usr/include

drwxr-xr-x 314 root wheel 10676 Jan 14 11:33 /usr/lib

drwxr-xr-x 53 root wheel 1802 Dec 19 13:20 /usr/share

drwxr-xr-x 13 root wheel 442 Jan 10 03:15 /usr/share/man

drwxr-xr-x 1853 root wheel 63002 Jan 5 19:10 /usr/share/man/man1


And trying to delete it using pkgutil with force doesn't work:

$ pkgutil -vf --forget org.x.x11.pkg

Unknown error Error Domain=NSCocoaErrorDomain Code=4 "“org.x.x11.pkg.bom” couldn’t be removed." UserInfo=0x7fde1bd981f0 {NSFilePath=/var/db/receipts/org.x.x11.pkg.bom, NSUserStringVariant=(

Remove

), NSUnderlyingError=0x7fde1bdbb380 "The operation couldn’t be completed. No such file or directory"}.

Forgot package 'org.x.x11.pkg' on '/'.


$ ls /var/db/receipts/org.x.x11.pkg

ls: /var/db/receipts/org.x.x11.pkg: No such file or directory


Even thought that I applied -f (force), it's still not removed from pkgutil's db/index:


$ pkgutil --pkgs | egrep -i "x11|XQuartz"

org.x.x11.pkg


So, is there a way I fix/rebuild pkgutil's db/index?

Mac Pro, OS X Mountain Lion (10.8.5)

Posted on Jan 14, 2015 3:32 AM

Reply
7 replies

Jan 14, 2015 6:28 AM in response to etresoft

Homebrew works fine with or without XQuartz (depending on if the packages you want to install from Homebrew depend on it or not)


"brew doctor" that I gave as an example, is there to help you find what could lead to a potential problem in the future.


I have tried to install XQuartz 2.7.7, but "brew doctor" will still complain about the old semi-existing X11 package, so hence the question:

How, if possible, do I you repair/delete pkgutil's faulty index for "org.x.x11.pkg"

Jan 14, 2015 2:35 PM in response to Mark Jalbert

$ sudo ls -1 /var/db/receipts/*[xX]11* /Library/Receipts/*[xX]11*

Password:

ls: /Library/Receipts/*[xX]11*: No such file or directory

ls: /var/db/receipts/*[xX]11*: No such file or directory


Didn't know about the /Library/Receipts/ folder, and in it, there was also a boms subdir which contained the broken x11 bom file


$ sudo rm /Library/Receipts/boms/org.x.x11.pkg.bom

$ pkgutil --pkgs | grep x11

$


That solved my question.

Thanks for the hint!

Jan 15, 2015 6:25 AM in response to pettai

Didn't know about the /Library/Receipts/ folder, and in it, there was also a boms subdir which contained the broken x11 bom file

Yes, I realized the regex would not list files in sub-directories in /Library/Receipts after I posted my reply. The bill of materials file is not broken or corrupt. There is a flaw in Homebrew's software. You might file a bug report with Homebrew's maintainors.

Jan 15, 2015 7:15 AM in response to Mark Jalbert

No, the bill of materials file for org.x.x11.pkg perhaps wasn't corrupt (since listing the content worked), I'll grant you that,

It was rather an error in the way pkgutil handled the (at least deletion of) old package, ref. my first post:


$ pkgutil -vf --forget org.x.x11.pkg

Unknown error Error Domain=NSCocoaErrorDomain Code=4 "“org.x.x11.pkg.bom” couldn’t be removed." UserInfo=0x7fde1bd981f0 {NSFilePath=/var/db/receipts/org.x.x11.pkg.bom, NSUserStringVariant=(

Remove

), NSUnderlyingError=0x7fde1bdbb380 "The operation couldn’t be completed. No such file or directory"}.

Forgot package 'org.x.x11.pkg' on '/'.

$ pkgutil --pkgs | egrep -i "x11|XQuartz"

org.x.x11.pkg


So I'd say the above is a separate pkgutil problem too.


I'll see if I can look into how homebrew searches for XQuartz installations later.


Thanks,

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Remove deleted/corrupt package(s) from pkgutil index?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.