You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to rebuild the whatis database? whatis command spewing lots of garbage and interfering will other tools.

How can I update the whatis database?


$ sudo /usr/libexec/makewhatis
Password:
makewhatis: /usr/share/man/whatis.tmp: Read-only file system


I believe being able to update this database will solve some other issue I'm having. My path to discovery as follows...


I recently started noticing that fish shell completions were annoyingly slow on my machine, possibly shortly after upgrading to Catalina.


I did a little profiling with fish -d5 and noticed that the majority of the time was spent on the apropos command. I did some reading and learned that the tools apropos, whatis and makewhatis are all related. They index man pages and make them searchable. Fish shell is (correctly) using them to offer helpful completions.


When I run whatis or apropos standalone, I get the following output:


$ whatis man
hugo-gen-man(1)          - Generate man pages for the Hugo CLI
groff_man(7)             - groff `man' macros to support generation of man pages
groffer(1)               - display groff files and man~pages on X and tty
man(1)                   - format and display the on-line manual pages
man.conf(5)              - configuration data for man
zshall(1)                - the Z shell meta-man page
xml2man(1)               - MPGL to mdoc (man page) translator
makewhatis: /usr/lib/./libgutenprint.2.dylib: No such file or directory
makewhatis: /usr/lib/libsasl2.2.0.1.dylib: Not a directory
makewhatis: /usr/lib/libldap.dylib: Not a directory
makewhatis: /usr/lib/libsqlite3.0.dylib: Not a directory
makewhatis: /usr/lib/libcom_err.dylib: Not a directory
...



Followed by at least 100 more lines of the "Not a directory" messages. I believe it is all these useless lines that are slowing things down.


So I thought maybe I just need to rebuild the whatis database (perhaps after the Catalina upgrade?). However, it doesn't seem to work:


$ sudo /usr/libexec/makewhatis
Password:
makewhatis: /usr/share/man/whatis.tmp: Read-only file system


So this part is a little disturbing. How can I rebuild the whatis database? I have a hunch this will solve my issues if I can figure it out.


MacBook Pro 15”, macOS 10.15

Posted on Oct 31, 2019 10:44 AM

Reply

Similar questions

9 replies

Oct 31, 2019 5:35 PM in response to fingel

"Is there any reason for using /usr filesystem istead of /tmp, /var/tmp?"

My guess is that /usr/share/man/whatis.tmp is going to be the new whatis file. After the new file is created it will be renamed from whatis.tmp to whatis


And for the most part the makewhatis creator did not expect any of the */man directories to be read-only.


So feel free to fine a bug report to Apple about makewhatis issuing errors.

BugReporter (Free ADC (Apple Developer Connection)) account needed for BugReporter

http://bugreporter.apple.com

Anyone can get a free ADC account at:

https://developer.apple.com/register/index.action

Oct 31, 2019 2:55 PM in response to fingel

I do not have Catalina. My guess is that /usr/share/man is on the read-only Catalina boot partition. And since I'm guessing it is a read-only partition, I would not expect any of the man pages in that partition to have changed since Apple shipped Catalina.


However, if you have create a MANPATH environment variable, with all the Other man directories on your system, such as those from HomeBrew, XCode, and any other 3rd party installed software, that makewhatis will create a .../man/whatis database file for each of them, and the whatis command will look in all of those it finds via MANPATH


sudo -s
Password: .............
export MANPATH="/usr/share/man:/opt/local/man:/usr/local/share/man:/usr/local/man:/opt/local/share/man:/Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/usr/share/man:/Developer/usr/X11/share/man:/Developer/usr/llvm-gcc-4.2/share/man:/Developer/usr/share/man:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/share/man:/Library/Developer/CommandLineTools/usr/share/man"
/usr/libexec/makewhatis

Fill in MANPATH with all the man page directories you can find.


Then make sure you define that MANPATH for your normal user environment.


Yes, you will get an error for the /usr/share/man directory if it is read-only, but all the other locations where you have a directory tree of man files, will get its own ./man/whatis file, and as long as the MANPATH environment variable exists when you are looking for man pages, each of those ./man/whatis files will be searched.

Oct 31, 2019 3:20 PM in response to BobHarris

BobHarris,


Thank you for your reply. I will give it a try as soon as I can. In the meantime, I'd like to share some other information I found from 9 years ago:


https://lists.freebsd.org/pipermail/freebsd-current/2010-May/017174.html


"I've installed a testing system with readonly /usr filesystem."


So way back then, this person was experimenting with the exact thing the Apple developers implemented for Catalina. And they got the same exact error as me.


"Is there any reason for using /usr filesystem istead of /tmp, /var/tmp?"


Which is a good point, if you read the actual error message, makewhatis is trying to write out a .tmp file. Perhaps by poor design, or some long forgotten reason, it's not using /tmp or another suitable temporary location. My suspicion is that Apple developers just overlooked the fact that making /usr read only for Catalina would break this particular tool.


Nov 22, 2019 1:14 PM in response to leroydouglas

There are much better answers here:


https://apple.stackexchange.com/questions/374025/errors-from-whatis-command-unable-to-rebuild-database-with-makewhatis/375769#375769


Consensus is that Apple broke apropos/whatis with the Catalina update. The fix should be simple for them to roll out so hopefully we get it in an update. Meanwhile it's possible to alias apropos/whatis or if you want a more serious fix you can disable SIP, reboot, mount /usr as r/w and fix the apropos command directly.

How to rebuild the whatis database? whatis command spewing lots of garbage and interfering will other tools.

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