-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1c738f
commit f544421
Showing
6 changed files
with
167 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Dump your dependencies | ||
slug: homebrew/dump-your-deps | ||
--- | ||
|
||
Homebrew has command that will export a manifest of brew-installed packages. | ||
|
||
```sh | ||
brew bundle dump | ||
``` | ||
|
||
The result is a `Brewfile` that looks like this: | ||
|
||
```sh title="~/Brewfile" | ||
tap "buo/cask-upgrade" | ||
tap "candid82/brew" | ||
tap "homebrew/bundle" | ||
tap "homebrew/services" | ||
brew "mas" | ||
brew "neovim" | ||
brew "node" | ||
brew "node@20" | ||
cask "font-jetbrains-mono-nerd-font" | ||
cask "visual-studio-code" | ||
vscode "esbenp.prettier-vscode" | ||
vscode "supermaven.supermaven" | ||
``` | ||
|
||
<!-- TODO: add mas to example --> | ||
|
||
The `Brewfile` is created in the directory where you run the command. | ||
But you can specify both file name and path with the `--file="~/some/path/my-brewfile"` option. | ||
|
||
```sh | ||
brew bundle dump --file="~/some/path/my-brewfile"" | ||
``` | ||
_Note that `brew bundle` commansd assume the file name `Brewfile`. So customizing the file name will required that all commands include the `--file` option, indifferent to file system location._ | ||
--- | ||
Congratulations. | ||
You now have a manifest of installed software on your system. | ||
<!-- TODO: possible appendixes: "tap, brew, cask, mas, and whale. what do they mean? anatomy of brewfile", "adding Brewfile to dotfiles (with symlinc)", "using the ---global flag to run brew bundle from anywhere", "installing from multiple brewfiles" --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
title: Bundling from Brewfiles | ||
slug: homebrew/bundling-from-brewfiles | ||
--- | ||
|
||
If you've used the default name of `Brewfile`, you can run the `brew bundle` command in that directory. | ||
|
||
```sh | ||
brew bundle | ||
``` | ||
|
||
And if you want to bundle from a specific file, use the `--file` flag. | ||
|
||
```sh | ||
brew bundle --file=~/.dotfiles/Brewfile | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Conditionally bundle apps with environment variables | ||
slug: homebrew/conditional-dependencies | ||
--- | ||
|
||
Brew bundle allows for conditional loading of dependencies, using environmental variables. | ||
|
||
As an examples, I use different versions of node on my work and personal machines. | ||
|
||
If want, I can always install the latest version of Node. But also install the LTS version on my work machine. | ||
|
||
```sh file="Brewfile" | ||
brew "node" | ||
brew "node@20" if [[ $MACHINE != "work" ]] | ||
``` | ||
To proc this, I need to set an environment variable when running the command: | ||
```sh | ||
MACHINE=work brew bundle | ||
``` | ||
<!-- TODO: test this command --> | ||
## Inverting the command with unless | ||
The Brewfile DSL also offers an `unless` keyword. | ||
This is identical to `!=` above. | ||
Use `unless`, if you think natural language reads better than code. | ||
```sh file="Brewfile" | ||
cask "arc" unless [[ $MACHINE == "work" ]] | ||
``` | ||
## Next steps | ||
I have a strong opinions about how to manage machine-specific environment variables. See the appendix on environment variables in the paid material for details. | ||
## Next chapters to write | ||
- understanding brewfile | ||
- mas | ||
- docker (whale) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: 'Appendix A: Basic Usage' | ||
slug: homebrew/basics | ||
--- | ||
|
||
If you're new to Homebrew, here are a few basics for adding command line applications, GUI applications, and fonts. | ||
|
||
## Install command line applications | ||
|
||
```sh | ||
brew install neovim | ||
``` | ||
|
||
## Install GUI apps with Cask | ||
|
||
```sh | ||
brew install --cask visual-studio-code | ||
``` | ||
|
||
## Install fonts with cask | ||
|
||
```sh | ||
brew install --cask font-jetbrains-mono-nerd-font | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: 'Appendix: Storing machine-specific environment variables' | ||
slug: 'homebrew/env-variables' | ||
--- | ||
|
||
ZSHELL is the default shell in MacOS. | ||
|
||
And there are several dotfiles it makes use of for very different needs. | ||
|
||
This isn't a `ZSHELL` course. So I'll get to the point but leave helpful references. | ||
|
||
<!-- link to docs on zsh --> | ||
|
||
## Use .zshenv to store machine-specific envs | ||
|
||
The best file for machine-spcefic inv variables `.zshenv`. | ||
|
||
At to keep in machine-specific, I make sure that this file is never saved in my [`.dotfiles`](https://chantastic/.dotfiles) with this line in git. | ||
|
||
```txt file=".gitignore" | ||
zshenv | ||
``` | ||
|
||
<!-- pitch course on managing dotfiles --> |