MacOS – Permission Denied for apropos command

bashmacospermissionterminal

I'm trying to list the contents of the whole apropos (makewhatis) database with the following command but I keep getting Permission denied.

sudo -s apropos . > touch thedatabase

-bash: touch: Permission denied


sudo -s apropos . > thedirectory

thedatabase: Permission denied


apropos . > touch thedatabase


All of these result in some form of Permission Denied. How do I get around this or what is the more elegant way of doing this?

Best Answer

I'm not sure how to do what you are asking. Looking into that now, but I know how to get around the permissions problems you are having with sudo.

Your syntax is wrong for sudo, the shell redirection ">" is happening without elevated privelleges. Try wrapping in quotes like this:

sudo -s 'apropos . > touch thedatabase'