Homebrew: Safe to remove .git folder in homebrew-core/homebrew-cask folder? - homebrew

Is it safe to delete the .git folder in homebrew-core/homebrew-cask? It takes up like 1GB of my disk and I def won't contribute to brew using git.

As discussed in here, it is safe to untap (aka remove) the homebrew-core and homebrew-cask taps, and then you manage the formulae/casks using HOMEBREW_INSTALL_FROM_API.

Related

How to revert Homebrew to a previous state after an update

I installed an app, which triggered an update of Homebrew and apparently also of some apps. Now I am unable to get some apps running, for example MySQL.
Some apps complain about not finding libicuuc.70.dylib after icu4c71.1 has been apparently installed by the update cycle.
I would like to revert the whole Homebrew installation to the point before the update was triggered to get my apps running again and to find out what went wrong. I can rely on TimeMachine.
Which directories do I have to replace through a backup?
I have the following directories in /usr/local :
/usr/local/bin
/usr/local/Caskroom
/usr/local/Cellar
/usr/local/etc
/usr/local/Frameworks
/usr/local/Homebrew
/usr/local/include
/usr/local/lib
/usr/local/opt
/usr/local/remotedesktop
/usr/local/sbin
/usr/local/share
/usr/local/var
At the end I resorted to restoring the complete /usr/local directory from a Timemachine backup and got all homebrew installed applications running again.
I did the following:
delete the content in /usr/local.
enter Time Machine and go to a specific time in the past, where the system was still running
selected all the files and directories and restored them
The var directory gets generated automatically by the system, once it is deleted, but it there where no conflicts. At first I tried to restore with out deleting the content of /usr/local before restoring it, but I got an error and the restore did not complete. After deleting it before the restore everything went through.
I still do not know what broke my system and would like to know more about Homebrew. In the time I am using homebrew it changed a lot the way it works and consequently my experience and the unexpected results I get sometimes.

Uninstalling Homebrew

I uninstalled Homebrew on my MAC, but got this message at the end:
The following possible Homebrew files were not deleted:
/opt/homebrew/SECURITY.md
/opt/homebrew/etc/
/opt/homebrew/share/
/opt/homebrew/var/
You may wish to remove them yourself.
I was able to remove the first item, but when I tried to remove the remaining three with "rmdir," I kept getting the "_____ is a directory" output. What am I missing?
Thanks.
Apparently, rmdir only works if the directory is empty, looking at this linux man page. You could try to remove them using rm -rf <path to folder> instead.
Maybe not an answer, but seems these folder are left on purpose. They are not part of the Homebrew package manager itself. But config, file, cache, etc content generated by brew-installed package.
Especially, make sure you have a backup of these settings before you remove it with rm -rf.

Is it possible to change the default app directory for home-brew casks to an external hard drive?

I am running out of space on my laptop, and I was wondering if it would be possible to change the default directory of installing casks on an external hard drive so that I can use the internal hard drive just for the OS and important files.
I guess you can overwrite the environment variable HOMEBREW_CASK_OPTS or you can use the --appdir=/my/path option. You can get more information with the command man brew-cask and there is a nice markdown documentation in the cask repository. Otherwise the executables can be found in the Applications folder.
EDIT:
Sometimes it helps to run a cleanup to delete the old versions:
brew cleanup
brew cask cleanup

Has /usr/local/Library/Contributions/ been deprecated?

For some time I've had a
/usr/local/Library/Contributions/
directory on my system and have been loading at least a brew_bash_completion.sh from it with
source $(brew --repository)/Library/Contributions/brew_bash_completion.sh
in my .bash_profile.
But suddenly I have no /usr/local/Library/Contributions/ directory at all!
Has this directory been moved or deprecated by Homebrew? What is the current best way to get support for brew bash completion?
The Homebrew completion script is at /usr/local/etc/bash_completion.d/brew (or, more generally, $(brew --prefix)/etc/bash_completion.d/brew). This change was made on April 3rd in commit edf000e when some parts of Homebrew were re-organized.

I cannot get git to ignore my tmp folder of my Ruby on Rails project

So I tried everything
but to no avail
I keep getting the following error
"fatal: cannot use tmp/ as an exclude file"
I have even tried using /tmp and tmp/* but none of these two work either .
Finally I deleted the tmp folder in frustration and i found that git now works perfectly
SO I have two questions.
The obvious one being . How do I get this to work?
Is it possible for me to run my ruby on rails applications without the tmp folder?
The obvious one being . How do I get this to work?
Add /tmp to your .gitignore at the root of your Rails app. Make sure you add and commit this .gitignore before committing /tmp — you'd have to git rm it to make it disappear from the repository again.
Is it possible for me to run my ruby on rails applications without the tmp folder?
No. Why would you? Rails needs to be able to write files there in order to work properly. You can only symlink it somewhere else, but that won't really solve the issue if the files are included in your repository. See also: Rails3: Change location of temp (tmp) directory
It may have to do with the way git works with cached files that the folder may still show up after including it in the .gitignore file.
Try git rm . -r --cached in the command line to clear out the cached files.

Resources