قالب وردپرس درنا توس
Home / Apple / terminal – How to update shell applications

terminal – How to update shell applications



Where is executable?

  command -v cron

The result shows / usr / sbin / cron . System Integrity Protection (SIP) protects the contents of / usr ; Thus, we cannot influence a change anyway as long as SIP is activated. You have installed BASH via Homebrew, I take it. Searching for Homebrew for cron-related formulas or filler reveals no candidates ( brew search cron ), perhaps for reasons given by @nohillside. Perhaps cron was a bad example, and a better example could be vim . As you have discovered, you can use a packet processing such as Homebrew or Macports to install newer software. For each installed package, Homebrew at least installs a symbolic link to where the executability was installed ( / usr / local / Cellar / [...]); Therefore, we can use a shell alias or change the PATH environment variable to exploit better versions of common software. I use the shell alias approach.

For example, my shell zsh and I have installed MacVim. If the symbolic link for MacVim's version of vim exists ( -h ), define a new alias. Now, every time I perform vim I do not run vim which is in / usr / bin ; rather, I perform vim located in / usr / local / bin . Below the test and definition works the same for bash.

  [ -h '/usr/local/bin/vim'  ] && alias vim = & # 39; / usr / local / bin / vim & # 39;
[ -h '/usr/local/bin/view' ] && alias view = & # 39; / usr / local / bin / view & # 39;


Source link