# Homebrew **[:fa-link: https://docs.brew.sh](https://docs.brew.sh)** [:fa-link: formulae.brew.sh](http://braumeister.org) ### Update Homebrew et les formules: ```bash $ brew update ``` ### Chercher les M-à-J: ```bash $ brew outdated # --verbose ``` ### Mettre tout à jour: ```bash $ brew upgrade # --cleanup Met à jour et supprime les anciennes versions installées. ``` ### Toutes les commandes: ```bash $ brew commands ==> Built-in commands --cache deps list search --caskroom desc log shellenv --cellar developer migrate tap-info --env docs missing tap --prefix doctor nodenv-sync uninstall --repository fetch options unlink --version formulae outdated unpin analytics gist-logs pin untap autoremove help postgresql-upgrade-database update-report casks home postinstall update-reset cleanup info pyenv-sync update commands install rbenv-sync upgrade completions leaves readall uses config link reinstall vendor-install ==> Built-in developer commands audit contributions generate-man-completions prof typecheck bottle create install-bundler-gems release unbottled bump-cask-pr determine-test-runners irb rubocop unpack bump-formula-pr dispatch-build-bottle linkage ruby update-license-data bump-revision edit livecheck sh update-maintainers bump-unversioned-casks extract pr-automerge style update-python-resources bump formula pr-publish tap-new update-sponsors cat generate-cask-api pr-pull test update-test command generate-formula-api pr-upload tests vendor-gems ==> External commands bundle services ``` ##### **brew bundle** Usage: brew bundle [subcommand] Bundler pour les dépendances non-Ruby provenant de Homebrew, Homebrew Cask, Mac App Store, Whalebrew et Visual Studio Code. **brew bundle [install]:** Install and upgrade (by default) all dependencies from the Brewfile. You can specify the Brewfile location using --file or by setting the $HOMEBREW_BUNDLE_FILE environment variable. You can skip the installation of dependencies by adding space-separated values to one or more of the following environment variables: $HOMEBREW_BUNDLE_BREW_SKIP, $HOMEBREW_BUNDLE_CASK_SKIP, $HOMEBREW_BUNDLE_MAS_SKIP, $HOMEBREW_BUNDLE_WHALEBREW_SKIP, $HOMEBREW_BUNDLE_TAP_SKIP. **brew bundle upgrade:** Shorthand for brew bundle install --upgrade. **brew bundle dump:** Write all installed casks/formulae/images/taps into a Brewfile in the current directory or to a custom file specified with the --file option. **brew bundle cleanup:** Uninstall all dependencies not present in the Brewfile. This workflow is useful for maintainers or testers who regularly install lots of formulae. Unless --force is passed, this returns a 1 exit code if anything would be removed. **brew bundle check:** Check if all dependencies present in the Brewfile are installed. This provides a successful exit code if everything is up-to-date, making it useful for scripting. **brew bundle list:** List all dependencies present in the Brewfile. By default, only Homebrew formula dependencies are listed. **brew bundle edit:** Edit the Brewfile in your editor. **brew bundle exec command:** Run an external command in an isolated build environment based on the Brewfile dependencies. This sanitized build environment ignores unrequested dependencies, which makes sure that things you didn't specify in your Brewfile won't get picked up by commands like bundle install, npm install, etc. It will also add compiler flags which will help with finding keg-only dependencies like openssl, icu4c, etc. **brew bundle sh:** Run your shell in a brew bundle exec environment. **brew bundle env:** Print the environment variables that would be set in a brew bundle exec environment. ##### **brew fetch** Usage: brew fetch [options] formula|cask [...] Télécharger une bottle (si disponible) ou les paquets sources pour les formules et les binaires pour les casks. Pour les fichiers, imprimer également les sommes de contrôle SHA-256. ##### **brew gist-logs** Usage: brew gist-logs [options] formula Transfère les logs d'un échec de construction de la formule vers un nouveau Gist. Présente un message d'erreur si aucun journal n'est trouvé. ##### **brew home** Usage: brew home, homepage [--formula] [--cask] [formula|cask ...] Ouvrir la page d'accueil d'une formule ou d'un cask dans un navigateur, ou ouvrir la page d'accueil de Homebrew si aucun argument n'est fourni. ##### **brew info** Usage: brew info, abv [options] [formula|cask ...] Affiche de brèves statistiques sur votre installation Homebrew. Si une formule ou un cask est fournie, afficher un résumé des informations la concernant. ### Formules: #### Mettre à jour une formule: ```bash $ brew upgrade # --cleanup Met à jour et supprime les anciennes versions installées. ``` #### Installer une formule: ```bash $ brew install $ brew install --verbose --debug # --build-from-source Compile la formule depuis la source même si une bottle est disponible. Les dépendances sont installées depuis les bottles. ``` #### Installer une formule d’ailleurs la branche: ```bash $ brew install https://raw.github.com/user/repo/branch/formula.rb ``` #### Reinstaller une formule depuis les sources: ```bash $ brew reinstall -s ``` #### Desinstaller une formule: ```bash $ brew uninstall # --force toutes les versions de la formule seront effacées # --ignore-dependencies desinstallera même si des dépendances restent installées ``` #### Desinstaller les anciennes versions d’une formule: ```bash $ brew cleanup # Supprime toutes les anciennes dans la Cellar et dans le Cache. # --dry-run (ou -n) montre ce qui va être supprimer mais n'enlève rien. # --prune=days supprime les fichiers du Cache plus vieux que jours. ``` #### Desinstaller toutes les anciennes versions: ```bash $ brew cleanup # (-n ou --dry-run) voir tout ce qui sera désinstaller ``` ```bash $ brew cleanup -s --dry-run Would remove: /opt/homebrew/Cellar/fontconfig/2.14.2 (88 files, 2.4MB) Would remove: /opt/homebrew/Cellar/jpeg-xl/0.8.2_1 (43 files, 10.8MB) Would remove: /opt/homebrew/Cellar/libvmaf/2.3.1 (234 files, 7MB) Would remove: /opt/homebrew/Cellar/rav1e/0.6.6 (14 files, 140.2MB) Would remove: /Users/bruno/Library/Caches/Homebrew/Cask/joplin--2.13.11.DMG (189.9MB) Would remove: /Users/bruno/Library/Caches/Homebrew/Cask/xpipe--1.7.12.pkg (135.4MB) <========= Would remove: /Users/bruno/Library/Caches/Homebrew/Cask/grandperspective--3.4.2.dmg (2.3MB) <= Would remove: /Users/bruno/Library/Caches/Homebrew/api-source/Homebrew/homebrew-cask/e1e3b95848535a463583201248b63a5bca90ecf8/Cask/kdiff3.rb (833B) Would remove: /Users/bruno/Library/Logs/Homebrew/perl (64B) Would remove: /Users/bruno/Library/Logs/Homebrew/openssl@3 (64B) Would remove (empty directory): /opt/homebrew/share/pear/htdocs Would remove (empty directory): /opt/homebrew/share/pear/cfg Would remove (empty directory): /opt/homebrew/share/pear/.registry/.channel.pecl.php.net Would remove (empty directory): /opt/homebrew/share/pear/.registry/.channel.doc.php.net Would remove (empty directory): /opt/homebrew/lib/php/pecl/20230831 Would remove (empty directory): /opt/homebrew/lib/perl5/site_perl/5.38/darwin-thread-multi-2level ==> This operation would free approximately 488MB of disk space. ``` ```bash $ brew cleanup --dry-run Would remove: /opt/homebrew/Cellar/fontconfig/2.14.2 (88 files, 2.4MB) Would remove: /opt/homebrew/Cellar/jpeg-xl/0.8.2_1 (43 files, 10.8MB) Would remove: /opt/homebrew/Cellar/libvmaf/2.3.1 (234 files, 7MB) Would remove: /opt/homebrew/Cellar/rav1e/0.6.6 (14 files, 140.2MB) Would remove: /Users/bruno/Library/Caches/Homebrew/Cask/joplin--2.13.11.DMG (189.9MB) Would remove: /Users/bruno/Library/Caches/Homebrew/api-source/Homebrew/homebrew-cask/e1e3b95848535a463583201248b63a5bca90ecf8/Cask/kdiff3.rb (833B) Would remove: /Users/bruno/Library/Logs/Homebrew/perl (64B) Would remove: /Users/bruno/Library/Logs/Homebrew/openssl@3 (64B) Would remove (empty directory): /opt/homebrew/share/pear/htdocs Would remove (empty directory): /opt/homebrew/share/pear/cfg Would remove (empty directory): /opt/homebrew/share/pear/.registry/.channel.pecl.php.net Would remove (empty directory): /opt/homebrew/share/pear/.registry/.channel.doc.php.net Would remove (empty directory): /opt/homebrew/lib/php/pecl/20230831 Would remove (empty directory): /opt/homebrew/lib/perl5/site_perl/5.38/darwin-thread-multi-2level ==> This operation would free approximately 350.3MB of disk space. ``` xpipe et et grandperspective sont 2 applis qui ont été désinstallées. #### Empecher la m-à-j d’un package: ```bash $ brew pin ``` ```bash bruno@SilverBook:/usr/local/Cellar/terminal-notifier/1.8.0$ brew pin terminal-notifier ``` ```bash $ brew pin php $ brew info php php: stable 7.4.0 (bottled) [pinned at 7.3.12] ``` Liste des paquets 'pinned': ```bash $ brew list --pinned php ``` Essayer de mettre-à-jour un paquet 'pinned': ```bash $ brew upgrade -n php Error: Not upgrading 1 pinned package: php 7.4.0 ==> No packages to upgrade ``` #### Re-permettre la m-à-j: ```bash $ brew unpin ``` #### Liste des formules installées: ```bash $ brew list # --versions affiche la verion en plus. # --pinned affiche les formules pinned ``` #### Afficher des infos sur une formule installée: ```bash $ brew info ``` ```bash $ brew info terminal-notifier terminal-notifier: stable 1.8.0 (bottled), HEAD Send macOS User Notifications from the command-line https://github.com/julienXX/terminal-notifier /usr/local/Cellar/terminal-notifier/1.7.1 (14 files, 2MB) Poured from bottle on 2016-10-19 at 07:24:46 /usr/local/Cellar/terminal-notifier/1.8.0 (5 files, 99.8KB) * Poured from bottle on 2017-08-12 at 20:20:48 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/terminal-notifier.rb ==> Requirements Build: xcode ✔ Required: macOS >= 10.8 ✔ ``` #### Description d'une formule: ```bash $ brew desc ``` ```bash $ brew desc httpd httpd: Apache HTTP server ``` #### Afficher les options d'une formule: ```bash $ brew options ``` ```bash $ brew options php72 --with-argon2 Include libargon2 password hashing support --with-cgi Enable building of the CGI executable (implies --without-fpm) --with-debug Compile with debugging symbols # --compact sur une seule ligne ``` #### Chercher une formule (avec description): ```bash $ brew search --desc ``` ```bash $ brew search --desc pdf briss: Crop PDF files diff-pdf: Visually compare two PDF files ``` #### Installer une ancienne version d'une formule: Exemple avec pipdeptree, outil por vérifier les dépendances python: passer de v 2.17.0 à v 2.16.2 - Aller sur https://github.com/Homebrew/homebrew-core/tree/master/Formula et rechercher la formule de [pipdeptree](https://github.com/Homebrew/homebrew-core/blob/master/Formula/p/pipdeptree.rb). - Cliquer sur [History](https://github.com/Homebrew/homebrew-core/commits/master/Formula/p/pipdeptree.rb) (à droite) - Cliquer sur **pipdeptree: update 2.16.2 bottle.** - A droite du bloc de code, cliquer sur les **3 points (...)**, puis sur **View file**. - En haut du bloc de code, cliquer sur **Raw**. - Copier / coller le contenu dans un fichier **pipdeptree.rb** ou `curl https://raw.githubusercontent.com/Homebrew/homebrew-core/df08a167320582bc009f8da3342f3af748651dbf/Formula/p/pipdeptree.rb > pipdeptree.rb` - Supprimer le package existant: `brew remove pipdeptree` - Installer pipdeptree en spécifiant la formule nouvellemnt créee: `brew install pipdeptree.rb` - La version 2.16.2 est installée: ```bash $ pipdeptree -v 2.16.2 ``` #### Configurer (arguments) une formule: ```bash $ brew edit ``` #### Afficher la homepage de Homebrew: ```bash $ brew home ``` #### Afficher la homepage de la formule: ```bash $ brew home ``` #### Log: ```bash $ brew log ``` #### « keg-only » La formule est installée dans Cellar. Elle n’est pas linkée dans /usr/local (elle n'est pas appelable directement, faire /usr/local/my-command_keg-only) Pour la linker: ```bash $ brew link ``` #### Changer de version de PHP: ```bash $ brew unlink php54 && brew link php53 ``` #### ### Dépendances: #### Voir les dépendances: ```bash $ brew deps ``` ```bash $ brew deps httpd apr apr-util boost c-ares jansson jemalloc libev libevent nghttp2 openssl pcre # --tree Présentation comme arbre ``` #### Montrer les formules installées qui ne sont pas des dépendances d'autres formules installées: ```bash $ brew leaves ``` #### Montrer les dépendances manquantes: ```bash $ brew missing $ brew missing ``` #### Dépendances inverses: ```bash $ brew uses x264 --installed ffmpeg ``` ```bash $ brew list -1 | while read cask; do echo -ne "\x1B[1;34m $cask \x1B[0m"; brew uses $cask --installed | awk '{printf(" %s ", $0)}'; echo ""; done ack aom ffmpeg apr apr-util httpd php php@7.2 .../... x264 ffmpeg ``` ### Outils: #### Vérifier le système: ```bash $ brew doctor ``` #### Prune (supprimer les liens symboliques morts): ```bash $ brew prune # --dry-run ``` #### Où va tout ce que télécharge Homebrew (cache): ```bash $ brew --cache /Users/bruno/Library/Caches/Homebrew ``` ```bash $ cd /Users/bruno/Library/Caches/Homebrew total 2616544 drwxr-xr-x 92 bruno staff 2944 17 jan 17:19 . drwx------+ 194 bruno staff 6208 18 jan 18:57 .. drwxr-xr-x 11 bruno staff 352 18 jan 18:54 Cask -rw-r--r-- 1 bruno staff 400053 28 oct 08:20 apr-1.6.3.high_sierra.bottle.tar.gz -rw-r--r-- 1 bruno staff 242481 3 nov 02:01 apr-util-1.6.1_1.high_sierra.bottle.tar.gz -rw-r--r-- 1 bruno staff 88679443 19 déc 10:23 boost-1.66.0.high_sierra.bottle.tar.gz -rw-r--r-- 1 bruno staff 3434 16 déc 20:15 brew-pip-0.4.1.tar.gz -rw-r--r-- 1 bruno staff 12310915 21 nov 13:01 cmake-3.10.0.high_sierra.bottle.tar.gz ``` #### Affiche le chemin de Cellar: ```bash $ brew --Cellar /usr/local/Cellar $ brew --Cellar httpd /usr/local/Cellar/httpd ``` #### Sauvegarder sa configuration Homebrew: Liste des packages, taps et casks installés: ```bash $ brew tap Homebrew/bundle $ brew bundle dump ``` Ceci crée un fichier Brewfile que l'on peut éditer. ```bash tap 'homebrew/php' brew 'homebrew/php/php71', args: ['with-imap'] brew 'shpotify' cask 'spotify' ``` #### Restaurer sa configuration: ```bash # Se positionner dans le répertoire contenant le fichier Brewfile $ brew bundle ``` ### Services: #### Liste des services gérés par brew services: ```bash bruno@SilverBook:~$ brew services list Name Status User File dbus none emacs none httpd started bruno ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist mariadb started bruno ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist php started bruno ~/Library/LaunchAgents/homebrew.mxcl.php.plist php@7.4 none redis started bruno ~/Library/LaunchAgents/homebrew.mxcl.redis.plist unbound none ``` #### Lancer au démarrage: ```bash $ brew services start mysql ``` #### Démarrer (pas au boot): ```bash $ brew services run mysql ``` #### Arrêter le service: ```bash $ brew services stop mysql ``` #### Redémarrer le service: ```bash $ brew services restart mysql ``` ### Taps (third-party repositories): [:fa-link: brew tap](https://docs.brew.sh/Taps.html) rajoute des repositories à **brew** #### Liste les repos tapped: ```bash $ brew tap homebrew/bundle homebrew/cask homebrew/cask-drivers homebrew/cask-fonts homebrew/core homebrew/services joedrago/repo shivammathur/extensions shivammathur/php sidneys/homebrew ``` Les tap sont situés là: ```bash /opt/homebrew/Library/Taps $ ls homebrew joedrago shivammathur sidneys ``` #### Ajouter un repo: ```bash $ brew tap ``` #### Supprimer un repo: ```bash $ brew untap ``` #### Configuration de Homebrew (brew config): ```bash $ brew config HOMEBREW_VERSION: 3.6.10 ORIGIN: https://github.com/Homebrew/brew HEAD: eaf887656ffb8e9e35ccf08081814d4735637564 Last commit: 13 hours ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 27b9f0718bb03e5ea933b5ceb5cd0cadb2bbd4a0 Core tap last commit: 19 minutes ago Core tap branch: master HOMEBREW_PREFIX: /opt/homebrew HOMEBREW_CASK_OPTS: [] HOMEBREW_EDITOR: nano HOMEBREW_MAKE_JOBS: 8 Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby CPU: octa-core 64-bit arm_firestorm_icestorm Clang: 14.0.0 build 1400 Git: 2.38.1 => /opt/homebrew/bin/git Curl: 7.79.1 => /usr/bin/curl macOS: 12.6-arm64 CLT: 14.1.0.0.1.1663981106 Xcode: 14.0.1 Rosetta 2: false ``` #### Afficher les formules qui ont le paquet cité comme dépendance (brew uses): ```bash $ brew uses autoconf asdf autoconf-archive automake crosstool-ng node-build php php@7.2 php@7.3 pyenv ruby-build vice # afficher uniquement les paquets installés $ brew uses --installed autoconf php php@7.2 php@7.3 pyenv $ brew info python@3.7 python@3.7: stable 3.7.9 (bottled) [keg-only] Interpreted, interactive, object-oriented programming language https://www.python.org/ Not installed From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/python@3.7.rb License: Python-2.0 ==> Dependencies Build: pkg-config ✔ Required: gdbm ✔, openssl@1.1 ✔, readline ✔, sqlite ✔, xz ✔ ``` #### Voir les dépendances d'un paquet: ```bash $ brew deps thefuck gdbm openssl@1.1 python@3.8 readline sqlite xz ``` #### Voir tous les packages installés, ainsi que tous les packages installés qui en dépendent: ```bash $ brew list -1 | while read cask; do echo -ne "\x1B[1;34m $cask \x1B[0m"; brew uses $cask --installed | awk '{printf(" %s ", $0)}'; echo ""; done annie antibody aom ffmpeg apr apr-util httpd php php@7.2 php@7.3 apr-util httpd php php@7.2 php@7.3 argon2 php php@7.2 php@7.3 argyll-cms displaycal aspell php php@7.2 php@7.3 atk gtk+ gtk+3 autoconf php php@7.2 php@7.3 pyenv ``` ### Commandes externes: #### brew caveats: Affiche les avertissements pour toutes les formules installées. ```bash $ brew tap zgracem/caveats $ brew caveats ==> libtool In order to prevent conflicts with Apple's own libtool we have prepended a "g" so, you have instead: glibtool and glibtoolize. ==> lua You may also want luarocks: brew install luarocks ==> mariadb A "/etc/my.cnf" from another install may interfere with a Homebrew-built server starting up correctly. MySQL is configured to only allow connections from localhost by default To connect: mysql -uroot To have launchd start mariadb now and restart at login: brew services start mariadb Or, if you don't want/need a background service you can just run: mysql.server start ==> mono To use the assemblies from other formulae you need to set: export MONO_GAC_PREFIX="/usr/local" ``` ### Environnement: - `HOMEBREW_AUTO_UPDATE_SECS`: If set, Homebrew will only check for autoupdates once per this seconds interval. *Default:* `300`. - `HOMEBREW_GITHUB_API_TOKEN`: A personal access token for the GitHub API, used by Homebrew for features such as `brew search`. You can create one at https://github.com/settings/tokens. If set, GitHub will allow you a greater number of API requests. For more information, see: https://developer.github.com/v3/#rate-limiting *Note:* Homebrew doesn’t require permissions for any of the scopes. - `HOMEBREW_NO_AUTO_UPDATE`: If set, Homebrew will not auto-update before running `brew install`, `brew upgrade` or `brew tap`. - `HOMEBREW_VERBOSE`: If set, Homebrew always assumes `--verbose` when running commands. - `HOMEBREW_NO_INSTALL_CLEANUP`: Si n'est pas mis, `brew cleanup` est lancé tous les 30 jours. ### coreutils (GNU Tools) Installer la version GNU des outils lignes de commande (OSX utilise la version BSD): ```bash $ brew install coreutils ``` Les outils GNU sont préfixés par la lettre **g** (**g**ls, **g**cat, **g**chmod...), permettant d'utiliser également leur pendant BSD (ls, cat, chmod...) *Les outils GNU sont installés dans /usr/local/bin/* *Un alias sans le préfixe **g** est crée dans /usr/local/opt/coreutils/libexec/gnubin/* ou */opt/homebrew/opt/coreutils/libexec/gnubin* ```bash ❯ ls /opt/homebrew/opt/coreutils/libexec/gnubin/ '[' b2sum, base32, base64, basename, basenc, cat, chcon, chgrp, chmod, chown, chroot, cksum, comm, cp, csplit, cut date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups head, hostid, id, install, join kill link, ln, logname ,ls md5sum, mkdir, mkfifo, mknod, mktemp, mv nice, nl, nohup, nproc, numfmt, od paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, realpath, rm, rmdir, runcon, seq, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum, sync tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort, tty, uname, unexpand, uniq, unlink, uptime, users, vdir wc, who, whoami yes ``` On peut ajouter le dossier /usr/local/opt/coreutils/libexec/gnubin (/opt/homebrew/opt/coreutils/libexec/gnubin) dans le $PATH. Les outils GNU sont alors disponibles sans préfixe, à la place des outils BSD. De même pour les man (`MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"`) ```bash # AVEC PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" ❯ which ls /opt/homebrew/opt/coreutils/libexec/gnubin/ls ❯ which gls /opt/homebrew/bin/gls (gls -> ../Cellar/coreutils/8.31/bin/gls) ❯ which /bin/ls /bin/ls ❯ ls --version ls (GNU coreutils) 9.1 ❯ gls --version ls (GNU coreutils) 9.1 # SANS PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" ❯ which ls /bin/ls ❯ which gls /opt/homebrew/bin/gls ❯ which /bin/ls /bin/ls ❯ ls --version ls: illegal option -- - ❯ gls --version ls (GNU coreutils) 9.1 ``` Utiliser date ou gdate: ```bash gnudate() { if hash gdate 2>/dev/null; then gdate "$@" else date "$@" fi } ``` #### findutils (GNU Tools) Comprend les versions GNU de *find, locate, xargs* (pas de updatedb dans osx ) ```bash $ brew install findutils # SANS PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH" $ which find /usr/bin/find $ which gfind /opt/homebrew/bin/gfind $ gfind --version find (GNU findutils) 4.9.0 Packaged by Homebrew Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Eric B. Decker, James Youngman, and Kevin Dalley. Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2) ``` Ajouter `PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"` et `PATH="/opt/homebrew/opt/coreutils/libexec/gnuman:$PATH"` au $PATH pour accéder aux commandes sans le préfixe **g**. Autres paquets GNU: - gnu-getopt (keg-only) - gnutls - grep (ggrep)(`PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"`) - moreutils (https://joeyh.name/code/moreutils/) - gnu-sed - gawk - gnu-tar - ... ### Erreurs: #### 1. `require': cannot load such file -- active_support/core_ext/object/blank (LoadError) ```bash # Erreur sur chaque commande brew... % brew doctor Traceback (most recent call last): 4: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `
' 3: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative' 2: from /usr/local/Homebrew/Library/Homebrew/global.rb:13:in `' 1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- active_support/core_ext/object/blank (LoadError) ``` Solution: Lancer **brew update-reset** pour réparer: ```bash % brew update-reset ==> Fetching /usr/local/Homebrew... remote: Enumerating objects: 38, done. remote: Counting objects: 100% (38/38), done. remote: Compressing objects: 100% (31/31), done. remote: Total 38 (delta 5), reused 31 (delta 2), pack-reused 0 Unpacking objects: 100% (38/38), done. From https://github.com/Homebrew/brew * [new branch] dependabot/bundler/Library/Homebrew/rubocop-rspec-1.37.0 -> origin/dependabot/bundler/Library/Homebrew/rubocop-rspec-1.37.0 ==> Resetting /usr/local/Homebrew... Branch 'master' set up to track remote branch 'master' from 'origin'. Reset branch 'master' Your branch is up to date with 'origin/master'. ==> Fetching /usr/local/Homebrew/Library/Taps/getantibody/homebrew-tap... ==> Resetting /usr/local/Homebrew/Library/Taps/getantibody/homebrew-tap... Branch 'master' set up to track remote branch 'master' from 'origin'. Reset branch 'master' Your branch is up to date with 'origin/master'. ``` #### 2. Some taps are not on the default git origin branch `brew doctor` dit: ```bash Warning: Some taps are not on the default git origin branch and may not receive updates. If this is a surprise to you, check out the default branch with: git -C $(brew --repo shivammathur/extensions) checkout master ``` Lancer `git -C $(brew --repo shivammathur/extensions) checkout master`: ```bash git -C $(brew --repo shivammathur/extensions) checkout master .github/scripts/edit.sh: needs merge .github/workflows/tests-all.yml: needs merge Formula/vips@7.0.rb: needs merge Formula/vips@7.1.rb: needs merge Formula/vips@7.2.rb: needs merge Formula/vips@7.3.rb: needs merge Formula/vips@7.4.rb: needs merge Formula/vips@8.0.rb: needs merge Formula/vips@8.1.rb: needs merge error: vous devez d'abord résoudre votre index courant ``` Solution: If you want to keep the changes you made to those formula there is nothing you need to do. `brew doctor` only provides information and if you don't have problems you don't need to change anything. If you want to discard the changes, the easiest way would be: ```bash git -C $(brew --repo shivammathur/extensions) add . git -C $(brew --repo shivammathur/extensions) reset --hard origin/master git -C $(brew --repo shivammathur/extensions) checkout master ``` La dernière commande dit: ```bash HEAD's previous position was on 13d8b20 imap@8.1: update 8.1.0 bottle. Switching to the 'master' branch Your branch and 'origin / master' have diverged, and have 1 and 54 different commits each respectively. (use "git pull" to merge the remote branch into yours) ``` Pour corriger, lancer: ```bash git -C $(brew --repo shivammathur/extensions) reset --hard origin/master ``` #### 3. fatal: It seems that there is already a rebase-merge directory ```bash fatal: It seems that there is already a rebase-merge directory, and I wonder if you are in the middle of another rebase. If that is the case, please try git rebase (--continue | --abort | --skip) If that is not the case, please rm -fr ".git/rebase-merge" and run me again. I am stopping in case you still have something valuable there. ``` Pour corriger, lancer: ```bash brew update-reset ``` #### 4. error: Unable to create '/opt/homebrew/Library/Taps/homebrew/homebrew-core/.git/index.lock': File exists. ```bash error: Unable to create '/opt/homebrew/Library/Taps/homebrew/homebrew-core/.git/index.lock': File exists. Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue. error: could not detach HEAD ``` Pour corriger, lancer: ```bash rm /opt/homebrew/Library/Taps/homebrew/homebrew-core/.git/index.lock ``` ### Réinstaller Homebrew ```bash cd $HOME brew bundle dump brew bundle cleanup # Désinstaller Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" cd $(brew --prefix) # Supprimer manuellement les restes cd $HOME # Réinstaller Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew bundle install ``` ### Cask: ### [:fa-link: Homebrew-Cask](brew-cask.md)