开发者

Is it possible to have too many $PATHs set in OS X?

I've been learning about gems lately, and one error I get is:

WARNING:  Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
  /usr/bin aren't both writable.
WARNING:  You don't have /Users/Alex/.gem/ruby/1.8/bin in your PATH,
 gem exec开发者_如何学运维utables will not run.
ERROR:  Error installing rubygame:
 ffi requires rake (>= 0.8.7, runtime)

I understand that UNIX (bash, more specifically) uses this .bash_profile file to know where to look for executables when I run a script/command, and that it does so "in order".

My question is: Can I just keep tacking directories on the end as I need them, and does doing this open me up to... anything?

(for what it's worth, I re-ran the command as "sudo gem..." and it still said "ERROR: Error installing rubygame: ffi requires rake (>= 0.8.7, runtime) )


You can add stuff to the end (or to the top) of PATH until you reach the length limit for a variable. Which is loooooong.

But it slows command searches. Every time you type a command the the executable is searched everywhere the PATH tells it to search until found. Commands typos may lead to non-existing files and those could get slow to sort out.


I believe bash caches the location of executables, so even if you have a long PATH it shouldn't take longer to run programs.

You could try sudo gem update rake for that last error...


I don't know of any limits of how long the $PATH var or any one env var can be. But I guess there is a limit on environment variables in general, something like 65KB total. Still not sure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜