I have a c-code written in Xcode 7, and running on my Mac laptop running El Capitain (OSX 10.11.6). The program calls another program, "bertini", using the following lines of code:
eflag = execvp("bertini", "input");
or alternatively
system("bertini input");
Both of these worked just fine before I upgraded my operating system (I was running either Xcode 3 or 4, I don't remember.) Now the program no longer works, because it can't find the program bertini.
I figured out the problem is that bertini is not on the search path, because in El Capitain, I am not allowed to copy executables to /usr/bin/. So, following instructions on this page: http://forums.appleinsider.com/discussion/189702/cant-copy-file-to-usr-bin-even-when-logged-in-as-root,
I moved the bertini executable to a folder of my choice, and changed ~/.bash_profile
to point to this folder. Now bertini runs just fine in the terminal, but not when it is called by my program.
How on earth can I get to program, when run in Xcode, to find the current location of bertini? I have tried inputting the full directory (/path/to/directory/containing/bertini/bertini), but this still doesn't work. I have also tried following instructions for previous versions of Xcode (eg as in this question where is $PATH set in xcode?) but it seems that the versions of Xcode are pretty different and I don't understand how to adapt these instructions. Also, the link in the response about setting ~/.MacOSX/environment.plist
is broken, and I'm nervous about changing files starting with a "." without knowing what I'm doing (I don't know much about this).
Note that this is for academic research, not for general use, so if I can get it to work on my machine only (well, two machines), that is fine.