brew :

패키지의 오래된 버전을 삭제하는 방법

Homebrew는 자체적으로 brew 로 업그레이드됩니다. 그리고 관리자가 brew cleanup와 같이 매일 사용하는 명령을 구현하지 않은 것 같습니다.

그렇다면 오래된 소프트웨어 버전을 자동으로 삭제하는 방법을 아는 사람이 있습니까?

$ brew Example usage: brew search [TEXT|/REGEX/] brew (info|home|options) [FORMULA...] brew install FORMULA... brew update brew upgrade [FORMULA...] brew uninstall FORMULA... brew list [FORMULA...] Troubleshooting: brew config brew doctor brew install -vd FORMULA Brewing: brew create [URL [--no-fetch]] brew edit [FORMULA...] https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md Further help: man brew brew help [COMMAND] brew home 

댓글

  • ' 확실합니다. '는 brew clean입니다.
  • rm -rf "$(brew --cache)"

답변

원하는 명령은 cleanup이며 brew cleanup는 디스크에 있지만 더 이상 설치되지 않은 패키지를 제거합니다.

> brew help cleanup brew cleanup [--prune=days] [--dry-run] [-s] [formulae]: For all installed or specific formulae, remove any older versions from the cellar. In addition, old downloads from the Homebrew download-cache are deleted. If --prune=days is specified, remove all cache files older than days. If --dry-run or -n is passed, show what would be removed, but do not actually remove anything. If -s is passed, scrubs the cache, removing downloads for even the latest versions of formulae. Note downloads for any installed formulae will still not be deleted. If you want to delete those too: rm -rf $(brew --cache) 

예 :

> brew cleanup Removing: /usr/local/Cellar/awscli/1.10.19... (2,955 files, 22.3M) Removing: /usr/local/Cellar/git/2.8.2... (1,418 files, 30.5M) Removing: /usr/local/Cellar/imagemagick/6.9.3-7... (1,459 files, 17.9M) Removing: /usr/local/Cellar/libgcrypt/1.7.0... (17 files, 1.5M) Removing: /usr/local/Cellar/libgpg-error/1.21... (19 files, 419.4K) Removing: /usr/local/Cellar/libksba/1.3.3... (13 files, 343K) Removing: /usr/local/Cellar/mercurial/3.7.3... (386 files, 4.7M) Removing: /usr/local/Cellar/node/6.0.0... (3,655 files, 38.8M) Removing: /usr/local/Cellar/openssl/1.0.2g... (1,678 files, 12.0M) Removing: /usr/local/Cellar/vim/7.4.1795... (1,687 files, 22.6M) Removing: /Library/Caches/Homebrew/git-2.8.2.el_capitan.bottle.tar.gz... (11.2M) Removing: /Library/Caches/Homebrew/imagemagick-6.9.3-7.el_capitan.bottle.tar.gz... (7M) Removing: /Library/Caches/Homebrew/libgcrypt-1.7.0.el_capitan.bottle.tar.gz... (565.4K) Removing: /Library/Caches/Homebrew/libgpg-error-1.21.el_capitan.bottle.tar.gz... (130.8K) Removing: /Library/Caches/Homebrew/libksba-1.3.3.el_capitan.bottle.tar.gz... (126.6K) Removing: /Library/Caches/Homebrew/node-6.0.0.el_capitan.bottle.tar.gz... (10.9M) Removing: /Library/Caches/Homebrew/openssl-1.0.2g.el_capitan.bottle.tar.gz... (3.6M) Removing: /Library/Caches/Homebrew/vim-7.4.1795.tar.gz... (12.0M) ==> This operation has freed approximately 196.4M of disk space. 

월요일 아침 요법이 있습니다.

brew update brew upgrade brew cleanup 

Homebrew에 대한 최신 정보를 얻었습니다. 내 설치된 양조장 중 더 이상 참조되지 않는 오래된 양조장을 제거하여 디스크 공간을 확보합니다. 특정 버전으로 유지해야하는 브루의 경우 brew pin를 사용하여 여기에 보관하므로이 간단한 세 가지 명령 체인을 실행하여 고정 된 패키지 주변의 다른 모든 것을 업데이트 할 수 있습니다. .

Answer

답은 아니지만 댓글을 작성하기에는 너무 깁니다. 내 양조주 최신 정보 :

 fullBrewUpdate(){ brew update brew cask update casks=( $(brew cask list) ) for cask in ${casks[@]} do # in the first line there is version current="$(brew cask info $cask | sed -n "1p" | sed -n "s/^.*: \(.*\)$/\1/p")" installed=( $(ls /opt/homebrew-cask/Caskroom/$cask)) if (! [[ " ${installed[@]} " == *" $current "* ]]); then (set -x; brew cask install $cask --force;) fi done brew upgrade brew cleanup } 

~/.bash_profile에 저장하여 터미널에서 호출 할 수 있습니다. 즉석에서 함수 이름으로.

댓글

  • 최소한 Brew 버전 1.5.12, brew cask update는 비활성화되어 있습니다. Error: Calling 'brew cask update' is disabled! Use 'brew update' instead.

답글 남기기

이메일 주소를 발행하지 않을 것입니다. 필수 항목은 *(으)로 표시합니다