{"id":15716149,"url":"https://github.com/lgug2z/bfm","last_synced_at":"2025-05-13T00:06:10.914Z","repository":{"id":104319022,"uuid":"100166989","full_name":"LGUG2Z/bfm","owner":"LGUG2Z","description":"Brewfile Manager","archived":false,"fork":false,"pushed_at":"2020-06-16T17:17:30.000Z","size":95,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T00:06:02.964Z","etag":null,"topics":["homebrew","macos"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LGUG2Z.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-13T09:36:43.000Z","updated_at":"2025-02-28T20:46:03.000Z","dependencies_parsed_at":"2023-03-13T06:45:45.768Z","dependency_job_id":null,"html_url":"https://github.com/LGUG2Z/bfm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LGUG2Z%2Fbfm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LGUG2Z%2Fbfm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LGUG2Z%2Fbfm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LGUG2Z%2Fbfm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LGUG2Z","download_url":"https://codeload.github.com/LGUG2Z/bfm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253843215,"owners_count":21972873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["homebrew","macos"],"created_at":"2024-10-03T21:44:13.914Z","updated_at":"2025-05-13T00:06:10.895Z","avatar_url":"https://github.com/LGUG2Z.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Brewfile Manager\nBrewfile Manager (bfm) is a command line tool for managing\na dependency whitelist in the form of a Brewfile in a less\nactive and more comprehensible way.\n\n## Requirements\n* [Homebrew](https://github.com/homebrew/brew)\n* [Homebrew Bundle](https://github.com/Homebrew/homebrew-bundle)\n* [Go](https://github.com/golang/go)\n\n## Install\nThe latest version of bfm can be installed using `go get`.\n\n```\ngo get -u github.com/LGUG2Z/bfm\n```\n\nMake sure `$GOPATH` is set correctly that and that `$GOPATH/bin` is in your `$PATH`.\n\nThe `bfm` executable will be installed under the `$GOPATH/bin` directory.\n\nIn order to use bfm the following environment variables\nfirst need to be exported in your shell rc file:\n\n```\nBFM_BREWFILE=/path/to/your/Brewfile\nBFM_LEVEL=[required, recommended, optional, build]\n```\n\n## Overview\nWhen adding a new package to a Brewfile whitelist, it is\nnot uncommon for that package to install other packages\nwhich are required dependencies, and depending on the\narguments given, recommended and optional dependencies too.\n\nThese additional dependencies, if not also added to the\nBrewfile, get marked for removal by the `brew bundle cleanup`\ncommand. So you add those dependencies to your Brewfile too,\nand eventually you end up with a Brewfile you struggle to\nmake sense of for all of these additional dependencies that\nhave been added for the cleanup command to remain useful.\n\nTake as an example the neovim package:\n\n```\nneovim: stable 0.2.0 (bottled), HEAD\nAmbitious Vim-fork focused on extensibility and agility\nhttps://neovim.io/\n/usr/local/Cellar/neovim/0.2.0_1 (1,352 files, 17.2MB) *\n  Poured from bottle on 2017-08-04 at 15:25:02\nFrom: https://github.com/Homebrew/homebrew-core/blob/master/Formula/neovim.rb\n==\u003e Dependencies\nBuild: luajit ✘, cmake ✔, lua@5.1 ✘, pkg-config ✔\nRequired: gettext ✔, jemalloc ✔, libtermkey ✔, libuv ✔, libvterm ✔, msgpack ✔, unibilium ✔\n```\n\nIf only neovim is whitelisted in the Brewfile, then the\n`brew bundle cleanup` command will suggest the removal of the\nrequired dependencies that are not directly whitelisted in the\nBrewfile but necessary to be able to use neovim. These can be\nadded manually to the Brewfile, but this approach very quickly\nleads to a Brewfile full of tersely named packages which may\nor may not all be required as packages are added and removed\nfrom the Brewfile over a period of time.\n\nUltimately, a whitelist where you can't look at the\npackages included and know exactly what is whitelisted and\nwhy, is not a very useful whitelist at all.\n\nBy setting a `BFM_LEVEL`, when performing any operation with\nbfm, the level of dependencies to operate on can be kept\nconsistent.\n\nWhen you add and remove packages using bfm, depending on the\nlevel chosen, all of the required, recommended, optional or\nbuild dependencies belonging to that package can also be\nadded, complete with annotations, or removed from the Brewfile\nat the same time.\n\n### Use Cases\nI have developed this tool primarily for my own personal use.\nI am a consultant and can find myself working on multiple\ndifferent software projects throughout the course of a year,\noften with quite a short turn around time between them. While\nit would be nice to have a fresh install of macOS every time I\njoin a new project or to use Vagrant for every project to ensure\na clean development environment, this is not always practical or\npossible.\n\nBy having a well managed and comprehensible Brewfile whitelist,\nfirstly, I can run `brew bundle cleanup --global --force` at the\nend of a project and be sure that I have no lingering packages\nthat are unneeded going forward into a new project, and secondly,\nI can look at my whitelist at any time and have great certainty\nabout what every brew installed package on my system is being\nused for.\n\n## Usage\n### Basics\nThe main commands of bfm are `add`, `remove`, `clean`, `check` and `refresh`. Information\nfor any of these commands can be found by running `bfm [cmd] --help`.\n\n#### Add, Remove, Clean\n`add`, `remove` and `clean` are destructive commands that will permanently modify your Brewfile without creating a backup.\n\nIt is recommended that if you are using bfm for the first time, you run these commands with the `--dry-run` flag.\n\nWhen adding to the Brewfile, a flag must be used to specify what is being added:\n\n```\nbfm add --tap homebrew/dupes\nbfm add --brew vim --args HEAD,with-override-system-vi\nbfm add --brew crisidev/chunkwm/chunkwm --restart-service changed\nbfm add --cask macvim\nbfm add --mas Xcode --mas-id 497799835\n```\n\nAdditional arguments for brew dependencies can be specified with the `--args` flag and service restart behaviour (`always`, `changed`) can be specified with the `--restart-service` flag.\n\nThe same flags must also be used with the `remove` and `check` commands.\n\n```\nbfm remove --tap homebrew/dupes\nbfm check --brew vim\nbfm remove --cask macvim\nbfm check --mas Xcode\n```\n\nThe `clean` command will organise your Brewfile and sort it into sections in\nthe following order: taps -\u003e primary brews -\u003e dependent brews -\u003e -\u003e casks -\u003e mas apps.\n\nBefore: \n```\nmas 'Xcode', id: 497799835\ncask 'macvim'\nbrew 'neovim'\nbrew 'gettext'\nbrew 'jemalloc'\nbrew 'libtermkey'\nbrew 'libuv'\nbrew 'libvterm'\nbrew 'msgpack'\nbrew 'unibilium'\n# brew 'emacs'\ncask 'firefox'\ntap 'caskroom/cask'\ntap 'homebrew/dupes'\n# cask 'google-chrome'\nbrew 'cmus'\n```\n\nAfter:\n```\ntap 'caskroom/cask'\ntap 'homebrew/dupes'\n \nbrew 'cmus'\nbrew 'neovim'\n\nbrew 'gettext' # [required by: neovim]\nbrew 'jemalloc' # [required by: neovim]\nbrew 'libtermkey' # [required by: neovim]\nbrew 'libuv' # [required by: neovim]\nbrew 'libvterm' # [required by: neovim]\nbrew 'msgpack' # [required by: neovim]\nbrew 'unibilium' # [required by: neovim]\n\ncask 'firefox'\ncask 'macvim'\n \nmas 'Xcode', id: 497799835\n```\n\nSplitting up the brews into primary and dependent sections helps to separate the signal\nfrom the noise. Essentially, you should have a clear understanding of what every package\nin the primary brews section does and why it is there. If you don't, it is worth rethinking\nits place in your whitelist.\n\nThe Brewfile is automatically cleaned after every `add` and `remove` operation.\n\n#### Check\nThe `check` command is a quick way to get feedback about the presence of a package\nin the Brewfile and, if it is a brew package, to get feedback about what its\ndependencies are and if the package itself is a dependency of another package.\n\n```\n❯ bfm check -b neovim\nneovim is present in the Brewfile.\n\nRequired dependencies: gettext, jemalloc, libtermkey, libuv, libvterm, msgpack, unibilium\nBuild Dependencies: luajit, cmake, lua@5.1, pkg-config\n\nNot a required, recommended, optional or build dependency of any other package.\n```\n\n```\n❯ bfm check -b gettext\ngettext is present in the Brewfile.\n\nNo required, recommended, optional or build dependencies.\n\nRequired dependency of: glib, gnupg, libmp3splt, neovim, weechat\n```\n\n#### Refresh\nThe `refresh` command will get information about all installable brews and casks\ngiven the repositories that have been tapped on the system, and stores it in a\nBoltDB file in the home folder.\n\nThis command should be run after adding a new tap and periodically to stay up\nto date with new information added after every `brew update`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flgug2z%2Fbfm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flgug2z%2Fbfm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flgug2z%2Fbfm/lists"}