I'm trying to install the cs50 library on my mac, and I found and followed the instructions here. All the terminal commands appear to execute without error. I also confirmed that the directories it tries to create /usr/local/include and /usr/local/lib exist and that the appropriate files were moved to each.

However when I #include the header file and try to compile in XCode, it says that it can't find cs50.h. Anyone have any ideas on why I'm having trouble? I'm on a Macbook Pro Retina 2012 running 10.9.4.

  • If it helps, when I'm done with all the terminal commands in the instructions, cs50.c is still in the original directory. I don't know if it was supposed to be moved or copied somewhere, but if it was it's not in the instructions. Aug 28, 2014 at 0:40
  • cs50.c should still be there. It's libcs50.a and cs50.h which should be moved. What do you see when you enter ls -l /usr/local/include or ls -l /usr/local/lib? If you don't see these files in those locations then something went wrong and you may need to redo it. Aug 28, 2014 at 11:50
  • Yep those files are there. Aug 28, 2014 at 13:49
  • Hmm, as I take a closer look at /usr/local/include, the permissions on cs50.h are different from all the other header files in that directory. Maybe that has something to do with it? Aug 28, 2014 at 14:04
  • cs50.h has -rw-r--r--@, every other .h file in that directory is lrwxr-xr-x. But isn't -rw-r--r--@ 644 as per the instructions? Aug 28, 2014 at 14:20

1 Answer 1


Have you linked the cs50 library by (-lcs50) ?

I think this is the solution for your problem .

  • Hmm, I don't think so, because XCode identifies that it can't find cs50.h right after I type the #include at the top, before compiling. Admittedly I don't know what XCode uses to compile, or how it goes about linking the libraries, but since it seems to know right away I wouldn't think that linking is the problem. Aug 28, 2014 at 13:51
  • I also did just try compiling something manually like I would for any of the coursework with clang and with -lcs50 and I'm getting the same "cs50.h file not found" Aug 28, 2014 at 13:57
  • Where have you placed the cs50.h file? Do you have environment variables set for include and lib directories?
    – Darc Nawg
    Sep 5, 2016 at 20:43

You must log in to answer this question.

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