0

Today I was trying to update openssl in my MacBook Pro with El Capitan 10.11.2. I don't know where I made a mistake but it seems I have accidentally disabled man. In fact, if I launch man <something> or man man or simply man it says --> -bash: man: command not found. Is there a way to restore it?

Some commands:

which man --> nothing

file /usr/bin/man --> man is a directory

I am afraid there's not an executable anymore. In fact, with ls -al /usr/bin/man I got

total 0
drwxr-xr-x     6 root  wheel    204 30 Dic 18:15 .
drwxr-xr-x  1063 root  wheel  36142 30 Dic 20:51 ..
drwxr-xr-x    46 root  wheel   1564 30 Dic 18:15 man1
drwxr-xr-x  1025 root  wheel  34850 30 Dic 18:15 man3
drwxr-xr-x     4 root  wheel    136 30 Dic 18:15 man5
drwxr-xr-x     3 root  wheel    102 30 Dic 18:15 man7
7
  • Try which man and file /usr/bin/man and update your question. :) Commented Dec 30, 2015 at 20:12
  • Ok, I have just added the command outputs
    – Lory Lory
    Commented Dec 30, 2015 at 20:15
  • Okay I'm curious now. Run ls -al /usr/bin/man and update your question. Commented Dec 30, 2015 at 20:17
  • done...I'm really afraid I deleted the bin :(
    – Lory Lory
    Commented Dec 30, 2015 at 20:20
  • With the other issues you had today it might be time to consider restoring from a Time Machine backup or a clean install of OS X. Commented Dec 30, 2015 at 20:22

1 Answer 1

1

Apple publishes the source code for the open source parts of OSX. So the source for "man" is retrievable from https://opensource.apple.com/tarballs/man/ . The latest version (as of this writing) is v1.6c. Provided you have at least the Command Line Tools installed (you can run xcode-select --install to get them if you don’t):

curl -LORf 'https://opensource.apple.com/tarballs/man/man-16.tar.gz'
tar -xzvf man-16.tar.gz
cd man-16/man

# Undo an Apple patch that adds a dependency on 'xcselect.h',
# which is something that Apple doesn't appear to distribute.
patch -R -p0 <../patches/PR11291804-xcode.diff

./configure --prefix=/usr/local
make
make install

That done, the man binary should be available at /usr/local/bin/man. Also note that you might need to run hash -r to clear the hash table of any instances of /usr/bin/man that may be lingering there from the last time you ran man before the addition to /usr/local/bin/ will be picked up.

2
  • That's probably for the best. And don't be so hard on yourself. Only way I seem to be able to learn is by making lots of mistak... experiments. And believe me I've made lots and lots and lots of mistak... experiments, in my time. :) Commented Dec 30, 2015 at 21:48
  • You're right but this, in my opinion, is a terrible mistake and I am supposed to be a "computer scientist"...anyway, thank you for your help. And have a good 2016!! :)
    – Lory Lory
    Commented Dec 30, 2015 at 21:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .