Homebrew: Install through a config file similar to pip's requirements.txt? - macos

As title, with Python's pip, you could do:
pip install -r requirements.txt
to batch install packages with specified versions.
Does Homebrew have the same system?
I quickly browsed brew's man page and couldn't find obvious switches.

Homebrew Bundle is the preferred way.
brew bundle dump
brew bundle

Yes, there is.
For example you can update brew.txt whatever you want.
brew list > brew.txt
<brew.txt xargs brew install
For specific versions
node 5.5.0
node4-lts 4.3.1

Related

Assign dependencies python version while brew installing

New for homebrew
Now want to install autojump via brew install autojump, which need to install python#3.9 as denpendency. I already have python#3.8 installed via brew and don't want an another version.
python#3.8 also satisfy autojump from it's homgpage
Impossible, that's not how Homebrew works.
Installing autojump with homebrew is basically
Creating a virtual environment with Python#3.9 (Homebrew always chooses the latest Python)
Install autojump package in that environment.
Unless you modify the autojump homebrew formula, You can't reuse python#3.8.
You can try the following
brew install autojump --ignore-dependencies

How to install python3.4-dev for Mac?

I have pip and homebrew I have tried
pip search python3.4-dev and also brew search python and can't find python3.4-dev in any of them any ideas?
Pip won't install Python itself. pyenv can help you install any specific Python version you want. Look here:
https://github.com/yyuu/pyenv#installation
Then after installation, you run
pyenv install 3.4-dev
OS X does not have this package available. However, the package list can be found on the Debian site here. These packages come with py3.5 by default. Just try:
brew install python3

Automated installation with Brew/cask in apps folder

I want create an automated script to use on a post installation.
For this reason i want use brew and cask to make it all.
So, i think that my script should start with that to install brew:
echo << "Installing homebrew..."
if test ! $(which brew); then
echo "Homebrew not found, Installing..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
Then i need to install some useful stuff as i see here:
http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac
So i put this too on my script:
# Install GNU core utilities (those that come with OS X are outdated)
brew install coreutils
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
brew install findutils
# Install Bash 4
brew install bash
# Install more recent versions of some OS X tools
brew tap homebrew/dupes
brew install homebrew/dupes/grep
$PATH=$(brew --prefix coreutils)/libexec/gnubin:$PATH
After that, the guide on the link says to install all the apps with cask and clean.
Here is my question.
I wish install and can update them in future using the classical Application folder of mac
How i can do that?
Maybe i should put this line:
export HOMEBREW_CASK_OPTS="--appdir=/Applications --caskroom=/usr/local/Caskroom"
Before all the commands to install the apps? May it works? (I have found this line here around)
If this line is correct can I update my apps using a brew/cask command?
Sorry for the dumbs questions, I've just discovered brew and cask yesterday :)
Any suggestion or example for this script is well accepted :)
brew cask install <formula> is supposed to symlink your app in Applications automatically.

How do I save and version brew packages?

I am used to installing packages and libraries via tools like npm, pip, and gem. These tools allow me to track the installed packages in some form or another (package.json, requirements.txt, or a Gemfile). This can then be checked into a repo and versioned.
I have a dotfiles repo on Github that I like to use as way to version control my machine configuration and I was wondering if there was a way to version control installed brew packages? If so how is this done? Something like brew install --save is what I am hoping for. :)
You’re looking for Homebrew Bundle.
It lets you keep track of installed formulae (packages) in a Brewfile.
You can then dump all the installed formulae in it with brew bundle dump, install all formulae from a bundle with brew bundle, and remove all installed formulae that aren’t listed in the bundle with brew bundle cleanup.
The syntax is very similar to Bundler’s, so it’s easy to edit the file by yourself.
It support both local Brewfiles (e.g. one per project) and a global one (~/.Brewfile).
Install it with:
$ brew tap homebrew/bundle
Here is a simple way for any *nix based system:
#create list of installed packages
brew list | xargs -L1 > Brewfile
# install packages
cat Brewfile | xargs brew
This is not as sophisticated as Homebrew bundle but it does the job if you're in a hurry.

homebrew uninstall ruby

I just installed ruby via
brew install ruby
I have been advised to install it via RVM, even if I use Homebrew, but first I want to uninstall the ruby that homebrew just installed.
Can I simply do
brew uninstall ruby
Or do I need to do something else?
Yes, brew uninstall ruby should do the trick.
For more info, you can type man brew in your terminal.
Doing brew uninstall ruby will work. If you really want to be sure, you can run brew cleanup after running the first command. Homebrew just removes unnecessary packages with the brew cleanup command. In some cases, the last command is necessary for the formula to be completely gone. (An example is with the tree formula, I had to use brew cleanup for it to be entirely uninstalled.)
(I know this is late but this can apply to anyone who is viewing this)
This might help other people who used rbenv to manage their ruby versions & have installed rbenv using the command below
brew install rbenv ruby-build
You can uninstall ruby by
brew uninstall rbenv && brew uninstall ruby-build
You can refer to the Installing Ruby section of this guide.

Resources