I’m trying to compile code and in order to get it to work I need to run the following line before compilation:
After this the code compiles normally, I’m trying to add this so that I do not need to run this line each time when I restart my PC. I’ve tried adding that line to the
.bashrcfile (does the file path needs quotes?) which has not seemed to work. I have also tried creating a
.bash_profilefile an adding the line in there but again this does not seem to work.
Whenever I try to compile after adding the
.bash_profileI am getting the following error:
./makeScript: line 1: pkg-config: command not found
It should work if you added it into
If this won’t work, make sure your script actually uses
bash shell (shebang), as if you’re using different shell, possibly it won’t be loaded.
However I think your problem is not related to
PATH variable which doesn’t contain the right directory where
pkg-config executable binary is present.
$ which pkg-config /usr/local/bin/pkg-config
If you can’t find it, make sure you’ve installed it and linked it, e.g. using Homebrew:
brew install pkg-config; brew link pkg-config
/usr/local/bin is in your
As a side note, you can check your export variables by running
set command just before the link which fails.
Another thing to track the problem is to debug your scripts by running like:
bash -x ./makeScript or adding
-x at the end of your shebang (e.g.