Adding Environment Variables


I can't understand the 3rd line in these instructions, found here

  1. Install dependency Ghostscript. On MacOSX: brew install ghostscript
  2. Create a symbolic link if you want to run it everywhere in bash ln -s pdfc
  3. Add in PATH environment variable On MacOSX: echo export=/absolute/path/of/the/folder/script/:$PATH >> ~/.bash_profile

What path are they talking about? The path where the ghostcript is? I don't know where that would be. When I ran echo export=/absolute/path/of/the/folder/script/:$PATH in terminal, nothing happened to the bash profile.


  • Placed the folder pdfc_master which contains the file in /users/bobsmith/codes/pdfc_master/

  • Run ln -s /users/bobsmith/codes/pdfc_master/ pdfc

  • Run echo export=/users/bobsmith/codes/pdfc_master/$PATH >> ~/.bash_profile

I now have the following syntax on my bash_profile


That looks wrong to me.

So I then ran in terminal:

pdfc /users/bobsmith/downloads/montale_eng3.pdf 0 /users/bobsmith/downloads/montale_eng2.pdf

And I got the error pdfc not found. I would think that pdfc would have to be somewhere in my bash_profile but it is not.

Best Answer

No, it is the path where you have created the pdfc symbolic link.

The command you ran was incomplete - you need to first replace /absolute/path/of/the/folder/script/ with the actual path to the pdfc symbolink link. In addition you must use the full command including >> ~/.bash_profile in order to actually get something saved in the bash profile.

Also, the 3rd line you quote is just wrong (also in Github itself), it should be

echo 'export PATH="/absolute/path/of/the/folder/script/:$PATH"' >> ~/.bash_profile

As you have already run the wrong command you'll need to edit your .bash_profile manually (e.g. with nano) to fix the wrong definition. Either source .bash_profile afterwards or open a new Terminal tab/window to load the new value.