title: gcc -lnsl error in socket programming on mac os
body: <p>I am trying to compile my C socket programming files using gcc with -lnsl option on MAC OS but it gives me this error:</p>
  
  <blockquote>
    <p>ld: library not found for -lnsl</p>
    
    <p>clang: error: linker command failed with exit code 1 (use -v to see
    invocation)</p>
  </blockquote>
  
  <p>This is the gcc command:</p>
  
  <pre><code>gcc -o server -lnsl server.c
  </code></pre>
  
  <p>I looked all over the internet but I can't find sth relevant to help me. How to install the missing library? Or should I reinstall gcc? Please help!</p>
  
  <p>Thanks!</p>