1

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 pdf_creator.py 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.


Update

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

  • Run ln -s /users/bobsmith/codes/pdfc_master/pdf_compressor.py pdfc

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

I now have the following syntax on my bash_profile

export=/users/bobsmith/codes/pdfc_master/pdf_compressor.py/:/Users/bobsmith/codes/venv/bin:/usr/local/opt/tcl-tk/bin:/Users/bobsmith/Applications/miniconda3/condabin:/Users/bobsmith/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.7/bin:/applications/google-cloud-sdk/bin:/usr/local/opt/openssl/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/PycharmProjects/book/superlists/chromedriver:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

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.

3
  • Have you tried homebrew? It's just easier to install and update packages such as Ghostscript.
    – AndrewC
    Dec 6, 2020 at 16:01
  • I have ghostscript installed. My problem is with understanding the termanal syntax
    – bobsmith76
    Dec 7, 2020 at 6:29
  • see updated answer for more details.
    – nohillside
    Dec 7, 2020 at 7:08

1 Answer 1

1

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.

4
  • Then I guess I don't understand step 2. Am I supposed to create a python file named pdf_creator.py? If so what is the py file supposed to be composed of?
    – bobsmith76
    Dec 6, 2020 at 11:01
  • pdf_creator.py is the program, you're trying to install. You download that file from the page in question. Then they describe how to make it easier to run that program by creating a shorthand "pdfc" to run the program without having to type the full path and filename.
    – jksoegaard
    Dec 6, 2020 at 11:09
  • Can't I just write the correct syntax in the bash_profile directly on the txt file? If I wrote the wrong definition then what is the right definition? Also, not familiar with nano. In short, what needs to be written in the bash_profile? What symbolic links need to be formed?
    – bobsmith76
    Dec 7, 2020 at 7:14
  • @bobsmith76 The line in .bash_profile currently starts with export=/users, you need to change this to export PATH=/users. nano shows a little help at the bottom when you start it which should make clear how to use it and save the file at the end.
    – nohillside
    Dec 7, 2020 at 7:46

You must log in to answer this question.

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