I created a Ruby file called Player.rb in the following path: Jwan/studio_game

Jwan is my name so I think Jwan is my user file.

How do I permanently add the path to the terminal so I don't have to type in pwd and cd commands everytime I open the terminal?

Also, what does the code below do. I tried finding the answer myself but I do not understand what the code below does. What parts of the code below do I replace?

export PATH=/users/ophir/android-sdks/tools:$PATH


First of all I'd confirm that path. I believe the full path might be "/User/Jwan/studio_game". Type ls -al /User/Jwan/studio_game into a Terminal window and see if it lists your file.

Assuming that works, then within the Terminal you could use the following command to add that location to your PATH variable. Then open a new Terminal window (or a new tab within the existing one) and the change should have taken effect.

echo export PATH='/User/Jwan/studio_game:$PATH' >> ~/.bash_profile

And just to explain that command...

  • echo says to write whatever follows to standard output.
  • export says you want to export a variable.
  • PATH is the name of the variable you want to export.
  • $PATH refers to the existing variable.
  • >> redirects standard output to a file. >> appends to the file if it exists, or creates it if it doesn't. > on its own would replace the file if it already existed.
  • ~ represents your home folder which I assume is /Users/Jwan.
  • .bash_profile is a file that is loaded whenever you open a new Bash session that can be used to run various commands to set up variables the most common being the PATH variable.
  • What is the Bash exactly? How is it different from Terminal? Also, what does standard output mean? – Jwan622 Oct 20 '14 at 3:34
  • This is the message I get: dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib Referenced from: /Users/Jwan/.rvm/rubies/ruby-2.1.3/bin/ruby Reason: image not found Trace/BPT trap: 5 – Jwan622 Oct 20 '14 at 5:00

I copy-pasted this code

echo export PATH='/User/Jwan/studio_game:$PATH' >> ~/.bash_profile

then I get this error:

dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib

Referenced from: /Users/Jwan/.rvm/rubies/ruby-2.1.3/bin/ruby
  Reason: image not found
Trace/BPT trap: 5

You must log in to answer this question.

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