Skip to main content
cleaned up
Source Link
Timo
  • 6.5k
  • 1
  • 28
  • 30

I'm a JS developer and hoping this is the right spot to ask this question.

Broadly, whatWhat is the PATH in a Mac OS? I have used it to install global command-line tools, but the only documentation I have found are tutorials for doing just that, with no real explanation of what is happening under the hood. I also haven't found a relevant page on Wikipedia.

So what is the purpose of PATH and what is the difference between /etc/paths and ~/.bash_profile**?

For example, in my paths file, I see this:

/usr/bin /bin /usr/sbin /sbin /usr/local/bin 

But in my ~/.bash_profile, I see this:

# Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH 

Is this just a user-specific addition to the paths file? What's all that stuff in paths, like /usr/bin?

I don't know Linux, but I've encountered this problem enough times to ask. Thanks in advance.

I'm a JS developer and hoping this is the right spot to ask this question.

Broadly, what is the PATH in a Mac OS? I have used it to install global command-line tools, but the only documentation I have found are tutorials for doing just that, with no real explanation of what is happening under the hood. I also haven't found a relevant page on Wikipedia.

So what is the purpose of PATH and what is the difference between /etc/paths and ~/.bash_profile**

For example, in my paths file, I see this:

/usr/bin /bin /usr/sbin /sbin /usr/local/bin 

But in my ~/.bash_profile, I see this:

# Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH 

Is this just a user-specific addition to the paths file? What's all that stuff in paths, like /usr/bin?

I don't know Linux, but I've encountered this problem enough times to ask. Thanks in advance.

What is the PATH in a Mac OS? I have used it to install global command-line tools, but the only documentation I have found are tutorials for doing just that, with no real explanation of what is happening under the hood. I also haven't found a relevant page on Wikipedia.

So what is the purpose of PATH and what is the difference between /etc/paths and ~/.bash_profile**?

For example, in my paths file, I see this:

/usr/bin /bin /usr/sbin /sbin /usr/local/bin 

But in my ~/.bash_profile, I see this:

# Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH 

Is this just a user-specific addition to the paths file? What's all that stuff in paths, like /usr/bin?

I edited my question down based on comments.
Source Link
jds
  • 994
  • 3
  • 10
  • 13

I'm a JS developer and hoping this is the right spot to ask these kinds of questionsthis question.

Broadly, what is the PATH in a Mac OS? I have used it to install global command-line tools, but the only documentation I have found are tutorials for doing just that, with no real explanation of what is happening under the hood. I also haven't found a relevant page on Wikipedia. That said, I have a few specific questions.

1. What is the purpose of PATH?

My understanding So what is that itthe purpose of PATH and what is a mappingthe difference between a command-line command/etc/paths and an executable. It's like a hosts file but for the OS. If that's wrong, let me know.

2. What is the difference between /etc/paths and ~/.bash_profile~/.bash_profile**

For example, in my paths file, I see this:

/usr/bin /bin /usr/sbin /sbin /usr/local/bin 

But in my ~/.bash_profile, I see this:

# Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH 

Is this just a user-specific addition to the paths file? What's all that stuff in paths, like /usr/bin?

As an aside, how did my Python install add that to my paths files but no other programs have asked me if I wanted to do that? Because I'd like that.

3. What is the difference between PATH and $PATH and ${PATH}?

I've seen all of them but don't understand their differences.

4. What does export PATH mean? When do we export?

More technically, is there a difference between

PATH="foo/bar/baz" export PATH 

and

export PATH="foo/bar/baz" 

If they are the same, can I concatenate across lines, such as:

PATH="foo/bar" PATH="baz/qux" export PATH 

5. How do I install a command-line tool?

I hope this question is answered by the othersknow Linux, but just in case you have something to add. My understanding is that I add a filesystem path to my paths file (or bash_profile) and that lets me type

jsdoc yourJavaScriptFile.js 

instead of

./node_modules/.bin/jsdoc yourJavaScriptFile.js 

BONUS QUESTION. Why are the files binary?

MaybeI've encountered this is tangential or ignorant, but it seems like a pattern, and I don't understand it. Why do command-line tools haveproblem enough times to be binary? Because the Linux shell only operates on that level? I'm spitballing hereask.

  Thanks in advance. If anyone tackles even a portion of these, I'd be grateful.

I'm a JS developer and hoping this is the right spot to ask these kinds of questions.

Broadly, what is the PATH in a Mac OS? I have used it to install global command-line tools, but the only documentation I have found are tutorials for doing just that, with no real explanation of what is happening under the hood. I also haven't found a relevant page on Wikipedia. That said, I have a few specific questions.

1. What is the purpose of PATH?

My understanding is that it is a mapping between a command-line command and an executable. It's like a hosts file but for the OS. If that's wrong, let me know.

2. What is the difference between /etc/paths and ~/.bash_profile

For example, in my paths file, I see this:

/usr/bin /bin /usr/sbin /sbin /usr/local/bin 

But in my ~/.bash_profile, I see this:

# Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH 

Is this just a user-specific addition to the paths file? What's all that stuff in paths, like /usr/bin?

As an aside, how did my Python install add that to my paths files but no other programs have asked me if I wanted to do that? Because I'd like that.

3. What is the difference between PATH and $PATH and ${PATH}?

I've seen all of them but don't understand their differences.

4. What does export PATH mean? When do we export?

More technically, is there a difference between

PATH="foo/bar/baz" export PATH 

and

export PATH="foo/bar/baz" 

If they are the same, can I concatenate across lines, such as:

PATH="foo/bar" PATH="baz/qux" export PATH 

5. How do I install a command-line tool?

I hope this question is answered by the others, but just in case you have something to add. My understanding is that I add a filesystem path to my paths file (or bash_profile) and that lets me type

jsdoc yourJavaScriptFile.js 

instead of

./node_modules/.bin/jsdoc yourJavaScriptFile.js 

BONUS QUESTION. Why are the files binary?

Maybe this is tangential or ignorant, but it seems like a pattern, and I don't understand it. Why do command-line tools have to be binary? Because the Linux shell only operates on that level? I'm spitballing here.

  Thanks in advance. If anyone tackles even a portion of these, I'd be grateful.

I'm a JS developer and hoping this is the right spot to ask this question.

Broadly, what is the PATH in a Mac OS? I have used it to install global command-line tools, but the only documentation I have found are tutorials for doing just that, with no real explanation of what is happening under the hood. I also haven't found a relevant page on Wikipedia.

So what is the purpose of PATH and what is the difference between /etc/paths and ~/.bash_profile**

For example, in my paths file, I see this:

/usr/bin /bin /usr/sbin /sbin /usr/local/bin 

But in my ~/.bash_profile, I see this:

# Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH 

Is this just a user-specific addition to the paths file? What's all that stuff in paths, like /usr/bin?

I don't know Linux, but I've encountered this problem enough times to ask. Thanks in advance.

Source Link
jds
  • 994
  • 3
  • 10
  • 13
Loading