4 ms·
So the history is awesome. But that's kind of the problem. Times change, and I think it would be so nice to just have a simple utility that whenever someone ins
by h_tbob 3y ago
So the history is awesome. But that's kind of the problem. Times change, and I think it would be so nice to just have a simple utility that whenever someone installs a package, it automatically registers all executables, you know?
Do you ever get frustrated when you install a library or something and can't seem to figure out where the executable is, cause you installed it with brew or something?
To me the real benefit is when people install a program, that they instantly get access without having to update their path manually! Plus by default the installation wouldn't override the existing items because they would just go second or third in line in the database.
I'm surprised more people don't think this would be a good idea. I honestly thought it would make all our lives so easy, not having to dink with path.
Honestly, do you find PATH frustrating? Or am I the only one?
- warrenm 3y ago>Times change, and I think it would be so nice to just have a simple utility that whenever someone installs a package, it automatically registers all executables, you know? So ... have the installer (whatever that may be (rpm, flatpack, snap, the admin extracting a tarball...) add an entry to $PATH like this: `export PATH = $PATH:/new/path/to/add/for/new/executables`
- h_tbob 3y agoOk think this through. I have to edit a variable by appending to a string. That makes no sense! I should have a simple command to prevent syntax errors! More importantly, how do you ensure that you can easily access the new one? For example lets say I am installing python. How do I easily set the python3 binary? With the system I propose, you simply run linpath info python3 >>>output /usr/bin/python3 /opt/homebrew/python3.10/etc/bin/python3 /opt/homebrew/python3.11/etc/bin/python3 This would tell me exactly which python3 executable I'm using, but also it would also allow me to set my favorite one: linpath select python3 ... shows a dialog where i can choose 1,2,3 etc. The nicest thing about this that you can't emulate with PATH is this: How do you have a simple list of all know locations of this binary? This would be so freaking useful when running multiple versions of "node" for example. You know what? I was thinking that we could also do this for compatibility: linpath search Then what it would do is search for all binaries on the system (i.e. executable files), and create it's own database. Then it could have a flag in the database that certain ones are not "registered", but when you try to run them, it echos "this command is available at /path/to/executable" but hasn't been linked. To link run `linpath activate binary_name`. Lastly, how is the installer to know where to update the PATH? .zshrc, .bash_profile, the systemwide one... So hard to understand! So probably the linpath should have a systemwide database, and a user specific database as well maybe. I'm not trying to argue, I just see so many shortcomings to PATH, specifically, the installer never knows what file to update, and it's not even available in cron jobs either. This can be remedied, but not without trouble! I think linux is great, but it's such a nerdy platform, I want to make it easier.
- warrenm 3y ago>Ok think this through. I have to edit a variable by appending to a string. That makes no sense! I should have a simple command to prevent syntax errors! "That makes no sense" Except ... it does and it has for over half a century
- warrenm 3y ago>Then what it would do is search for all binaries on the system (i.e. executable files), and create it's own database. Then it could have a flag in the database that certain ones are not "registered", but when you try to run them, it echos "this command is available at /path/to/executable" but hasn't been linked. To link run `linpath activate binary_name`. You ... just described updatedb and locate Don't want to use the binary in $PATH? Give the full path to the one you want
- warrenm 3y ago>I'm not trying to argue Except ... you are - what you're describing just is not efficient Maybe you've grown accustomed to the Windows Registry - are you also familiar with all the problems it has (vs the rock-solid, impossible to break environment variable)? >I just see so many shortcomings to PATH, specifically, the installer never knows what file to update, and it's not even available in cron jobs either. Of course an install can "know what file to update" - because it's not a file! It can put (if appropriate) a symlink to the executable into a normal location used by $PATH, or it can create its own environment variables for when it runs Or - as a last resort - it could update $PATH (a generally-bad idea, but still possible)
- h_tbob 3y agoRegarding the registry, I was under the impression you have to update the PATH on windows as well. I have tried dinking with it, and without updating the path, the command line can't find the proper programs. Am I missing something?
- warrenm 3y agoSome commandline tools references the registry Some do not