Homebrew - installed elsewhere and can't run it - homebrew

I have incorrectly installed Homebrew to a different folder and now can't interact with it nor uninstall it. It is located in: users/pavel/learningpython/homebrew
Is there a safe way to uninstall it all or reconfigure it so I can run it?
Thank you
I tried to change directory to various folders, be it those under the homebrew folder or outside of it, but can't seem to run homebrew anywhere. At first, when I was not able to even locate it, I tried various solutions with the .zshr file and it was not helpful. So I see Homebrew in Mac Finder, but can't find a way to interact with it, it always says "brew not found".
This is what the brew executable file writes when I run it through Finder:
/Users/pavel/learningpython/homebrew/bin/brew ; exit;
/Users/pavel/.zprofile:6: no such file or directory: /opt/homebrew/bin/brew
/Users/pavel/.zprofile:7: no such file or directory: /opt/homebrew/bin/brew

Related

Finding the binary's name after package installation

When I installed 7zip via home brew (Formula sevenzip), i noticed that i cannot run it via sevenzip and even brew info sevenzip did not tell me the name of the binary.
Only after looking in the script file on Github I noticed a command 7zz but there must be an easier way to find out the binaries or commands associated with a homebrew package.
The simplest I know is:
brew ls PACKAGE
and you can normally see it pretty quickly. Personally, I use p7zip as PACKAGE.
Alternatively, as brew --prefix tells you where binaries are installed (via symlinks), you can find the newest installed binary with:
ls -lrt $(brew --prefix)/bin
and it's the last one listed.

Installing Wine on Mac OS Catalina. Error: No available formula with the name "wine"

I'm trying to install Wine on my Mac via Brew. I'm using Catalina and just updated brew, installed XQuartz and have Xcode installed. When I type the command "Brew install wine" it returns the following:
Error: No available formula with the name "wine"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
wine was deleted from homebrew/core in commit 82bd38bc:
wine: delete
To show the formula before removal run:
git -C "$(brew --repo homebrew/core)" show 82bd38bc^:Formula/wine.rb
If you still use this formula consider creating your own tap:
https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap
I'm following this tutorial: https://www.davidbaumgold.com/tutorials/wine-mac/
When I run Brew doctor I get the following:
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7-config
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7m-config
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3-config
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libtcl8.6.dylib
/usr/local/lib/libtk8.6.dylib
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/fakemysql.h
/usr/local/include/fakepq.h
/usr/local/include/fakesql.h
/usr/local/include/itcl.h
/usr/local/include/itcl2TclOO.h
/usr/local/include/itclDecls.h
/usr/local/include/itclInt.h
/usr/local/include/itclIntDecls.h
/usr/local/include/itclMigrate2TclCore.h
/usr/local/include/itclTclIntStubsFcn.h
/usr/local/include/mysqlStubs.h
/usr/local/include/odbcStubs.h
/usr/local/include/pqStubs.h
/usr/local/include/tcl.h
/usr/local/include/tclDecls.h
/usr/local/include/tclOO.h
/usr/local/include/tclOODecls.h
/usr/local/include/tclPlatDecls.h
/usr/local/include/tclThread.h
/usr/local/include/tclTomMath.h
/usr/local/include/tclTomMathDecls.h
/usr/local/include/tdbc.h
/usr/local/include/tdbcDecls.h
/usr/local/include/tdbcInt.h
/usr/local/include/tk.h
/usr/local/include/tkDecls.h
/usr/local/include/tkPlatDecls.h
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .pc files:
/usr/local/lib/pkgconfig/tcl.pc
/usr/local/lib/pkgconfig/tk.pc
Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/libtclstub8.6.a
/usr/local/lib/libtkstub8.6.a
I'm not sure these warnings has something to do with it.
Thanks in advance!
I was able to build Wine 64 bit from source on macOS Catalina and successfully run Notepad++ 64 bit on it.
My steps were more or less something like that:
Download Wine 4.20 from https://dl.winehq.org/wine/source/4.x/wine-4.20.tar.xz
Extract it
In terminal go to extracted directory
Run: ./configure --enable-win64
It showed that it cannot find some library (I do not remember what exactly) so I installed it with macports (sudo port install name_of_missing_package reported by ./configure)
After I was able to run ./configure --enable-win64 succesfully without errors in terminal run: make
It compiled after more than 30 minutes.
I run it with: ./wine start
It opened windows console and here I was able to cd to Notepad++ 64 bit directory (downloaded from https://notepad-plus-plus.org/repository/7.x/7.0/npp.7.bin.x64.zip note that newest version did not work and throwed some errors about some dll's)
I typed notepad++ to run exe file
It showed some errors about freetype fonts so I installed them with macports and I had to copy them from /opt/X11/lib to /usr/local/lib before wine detected them
After fixing freetype fonts problem I was able to run notepad++
Also you might want to run: sudo spctl --master-disable to disable gatekeeper if you will see some system alerts about loading app from unknown developer.
Also note that instead of ./wine start you can run ./wine explorer for graphical file manager instead of console
Those steps might not be exactly precise, as I'm not sure if I did not miss something but hope it will help someone.
Also note that obviously wine on macOS Catalina will be able to run only some 64 bit windows apps and all 32 bit windows app will not work. I also tested it with IrfanView 64 bit (https://www.fosshub.com/IrfanView.html?dwl=iview453_x64_setup.exe) and it also works fine.
In case you wanted to get wine working for purpose of running 32 bit games then unfortunately it will not work with wine but you can try with virtualbox. You can check https://www.youtube.com/watch?v=3AO8dF0vviQ for some performance improvements tips.
Wine hast been removed from homebrew due to the incompatibility to Macos Catalina
https://discourse.brew.sh/t/issue-with-wine/6188/3
Try using wine64 to run your .exe files after installing wine. The manuals and references don't seem to mention this explicitly.
More Info
I followed the guidance in the wine manual to install using home-brew. After install, I got an error when trying to test the installation like it says in the quickstart.
Install wine-stable using homebrew
brew tap homebrew/cask-versions
brew install --cask --no-quarantine wine-stable
After install, test by opening notepad
wine notepad
zsh: bad CPU type in executable: wine
While uninstalling wine, I noticed one of the linked libraries was called wine64. I immediately reinstalled and tried again using wine64 as the call, as I am using wine on an M1 Mac. This was successful!
You can also use winehelp to get access to more commands that will work with 64bit processor.
Based on https://github.com/Homebrew/homebrew-core/pull/46556#issuecomment-559938873 you can do brew cask install wine-stable on newer version of OS X. And works with recent versions of homebrew since the source version was moved :(
How to install wine on Mac OS Catalina with brew
install homebrew with
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
install xquartz to install wine using brew
brew cask install xquartz
install wine using brew
brew install homebrew/cask-versions/wine-devel
run wine and check the version
wine64 --version
As of Wine 5.0 there is no 32bit support on mac in the official version, but you are able to achieve it via the
Unofficial Wineskin Winery
You can download it from github releases here. And then create a Wineskin with WS11WineCX[64/32]bit19.0.[0/1]. All WS11 versions support Catalina. To use it you also need to turn off the no32exec boot argument. You theoretically can do it by typing:
sudo nvram boot-args="no32exec=0"
into the Terminal while you're logged in but it didn't work out for me, so if you'll have the same problem, reboot into the Recovery mode, in the menubar pick Utilities -> Terminal and type just:
nvram boot-args="no32exec=0"
(without sudo).
Example
To be more exact, to install eg. Steam 32bit, you would:
Install the Unofficiall Wineskin Winery from the provided link
Turn on the 32bit execution boot argument by going into Recovery Mode and entering nvram boot-args="no32exec=0" into the terminal
Open Wineskin, click the '+' sign and scroll down to find the WS11WineCX64bit19.0.1 (the newest version with 64 and 32 bit support, at the time of writing)
Click update/install under the Wrapper Version.
Click Create New Blank Wrapper, name it and click through installation of mono and gecko.
Launch the Wrapper App from Finder. Click Install Software, choose setup executable, and proceed through installation. Then pick the executable from a menu. (In case of steam, Steam.exe)
Note: If you get the "No windows app to open the file"(Like I did) error, click advanced -> configuration and set the Windows EXE to the path to the installer. Then find the place that it has installed in and set that as Windows EXE. Then you can run by clicking Test Run.
Enjoy your windows app, as an .app file!
Hope I helped!

How to fix Brew's symlink errors when Brew thinks the link already exists?

Please help understand what is going on--or whether any action is required. I've gone through a lot of posts on dealing with brew, node, symlink, uninstalled and reinstalled node, npm, yarn, tried brew cleanup. When brew doctor produced these warnings--
Warning: Broken symlinks were found. Remove them with `brew prune`:
/usr/local/lib/node_modules/npm/node_modules/.bin/JSONStream
/usr/local/lib/node_modules/npm/node_modules/.bin/errno
/usr/local/lib/node_modules/npm/node_modules/.bin/is-ci
/usr/local/lib/node_modules/npm/node_modules/.bin/node-gyp
/usr/local/lib/node_modules/npm/node_modules/.bin/opener
/usr/local/lib/node_modules/npm/node_modules/.bin/qrcode-terminal
/usr/local/lib/node_modules/npm/node_modules/.bin/rc
/usr/local/lib/node_modules/npm/node_modules/.bin/semver
/usr/local/lib/node_modules/npm/node_modules/.bin/sshpk-conv
/usr/local/lib/node_modules/npm/node_modules/.bin/sshpk-sign
/usr/local/lib/node_modules/npm/node_modules/.bin/sshpk-verify
/usr/local/lib/node_modules/npm/node_modules/.bin/uuid
/usr/local/lib/node_modules/npm/node_modules/.bin/which
When I tried brew prune, I got:
newmbp$ brew link node
Warning: Already linked: /usr/local/Cellar/node/10.11.0
I noticed the files (to be linked or unlinked) are in separate folders, but have been struggling to understand the implications of having files in /usr/local/Cellar vs in /usr/local/lib
The precipitating factor that led to all of this was the fan on my laptop runs furiously from time to time, often while MAMP is running.
brew cleanup --prune-prefix (ex- brew prune) removed the broken symlinks, so the issue should be gone.
The fact that brew link node complains has nothing to do with this; it’s a completely different command. It’s not even an error, just a warning: "you asked me to link node but it’s already linked" so everything’s fine here.
Homebrew installs its files in /usr/local/Cellar. On the other hand, /usr/local/lib is a shared directory commonly used for libraries. In order for software to find libs Homebrew installed, it symlinks them in it.
For example, let’s say you have a formula foo version 1.2.3 that installs a library bar. After running brew install foo you should get something like this:
# the library files
/usr/local/Cellar/foo/1.2.3/lib/bar
# a symlink to the library files from /usr/local/lib
/usr/local/lib/bar -> /usr/local/Cellar/foo/1.2.3/lib/bar
If you brew uninstall foo, it removes both the library files and the symlink.
Those Homebrew symlinks can be manipulated with brew unlink <formula> (remove them) and brew link <formula> (add them). brew install runs brew link for you so you don’t need to. This is the reason why you get a warning: your Node symlinks already exist.
brew doctor performs various checks, including check_for_broken_symlinks. This one looks into directories such as /usr/local/var or /usr/local/lib for broken symlinks. A broken symlink is a symlink whose target doesn’t exist, often because it has been removed.
The important point to understand here is that Homebrew looks at all symlinks, not just the ones it created. Broken symlinks may cause issues, which is why Homebrew warns you about them, but if everything’s working fine for you feel free to ignore the warning.

How can I make Homebrew and CocoAspell coexist?

After much searching on the Internet, I have never seen a satisfactory answer or explanation to the following problem. I would like to use CocoAspell for system-wide spell-checking on OS X 10.9 (plugs into TexShop, TextMate, etc.), but every time I install it, brew doctor starts throwing the following warnings:
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libaspell.15.1.4.dylib
/usr/local/lib/libpspell.15.1.4.dylib
Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
/usr/local/lib/libaspell.la
/usr/local/lib/libpspell.la
Internet searches have shown that these warnings never seem to lead to any errors, but it seems to me that there must be some way to suppress them. Partly, I like to see the Your system is ready to brew notification, but I'd also like to avoid some sort of "boy crying wolf" situation, where I become accustomed to brew doctor throwing errors.
Is there a way to either:
Install CocoAspell in another location, such that brew doesn't see it
Hide the offending dylib and .la files from brew doctor
Or enable the CocoAspell preference pane/program to access libraries installed by a brewed version of aspell
Uninstalling CocoAspell and trashing the offending files results in a clean bill of health, and performing brew install aspell results in a working version of aspell, but this doesn't help me with any of the GUI applications I prefer for LaTeX editing.
Uninstall cocoAspell completely if you installed it before.
Install aspell with homebrew or any other package manager. Don't forget the dictionaries you need. I wanted English and Czech, so I used
brew install aspell --with-lang-cs --with-lang-en
Install only the preference pane of cocoAspell. Click on "Customize" before installing and only select the "Spelling" option.
Create the directory /Library/Application Support/cocoAspell/
Make a symlink in the directory to make the preference pane aware of the available dictionaries (as the administrator):
cd /Library/Application\ Support/cocoAspell/
ln -s /usr/local/lib/aspell-0.60 Dictionaries
Make sure that /usr/local/lib/aspell-0.60 is the correct path.
The cocoAspell pref pane now shows the installed dictionaries.
Add the offending files to the white_list in doctor.rb. Mine was in /usr/local/Library/Homebrew/cmd/doctor.rb
If your's isn't there, find it with
locate doctor.rb
Look for white_list in side of def check_for_stray_dylibs, mine was on line 105. It should probably look like this.
white_list = {
"libfuse.2.dylib" => "MacFuse",
"libfuse_ino64.2.dylib" => "MacFuse",
"/usr/local/lib/libTrAPI.dylib" => "TrAPI"
}
An alternative is to install Homebrew somewhere other than /usr/local (that is, create ~/.homebrew, or /Tools/homebrew; then sudo chmod $USER /Tools/homebrew, untar Homebrew there, and add /Tools/homebrew/bin to your $PATH). That way, /usr/local is reserved for things you're installed there by some other means, rather than using Homebrew; for example the situation you describe here. Homebrew still occasionally whines about it, but you can usually ignore it.
I use Homebrew as my principal OS X package manager; I don't let it anywhere near /usr/local.
Note that this advice is the direct opposite of Homebrew's insistent dogma, which I myself find unpersuasive.

Homebrew - repeated "linking" bug. What is the underlying issue here?

So I've been using homebrew to install various packages/libraries/programs on my mac. I keep running into a problem in which homebrew tells me that I have unlinked kegs in my Cellar.
For instance, upon running brew install phantomjs I received the following message:
Warning: Could not link phantomjs. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link phantomjs'
Possible conflicting files are:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I tried running brew link phantomjs as recommended, and hit a similar problem:
Error: Could not symlink file: /usr/local/Cellar/phantomjs/1.9.2/bin/phantomjs
Target /usr/local/bin/phantomjs already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
brew link --overwrite formula_name
The command brew link --overwrite --dry-run phantomjs gives the following message:
Would remove:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I will probably go ahead and overwrite, but this appears to happen every time I try to install something with homebrew. Why? Why isn't homebrew working as expected?
Thanks.
From what I can tell, looks like you have previously done:
% sudo npm install -g phantomjs
In this case, you should do the following:
% sudo npm uninstall -g phantomjs
% brew link --overwrite phantomjs
I thought I'd take a crack at this. I ran into a similar problem today, and I think it may be related to this:
https://github.com/Homebrew/homebrew/issues/22408
Long story short, I think it has to do with how npm manages packages vs how brew does it. (I'm assuming you installed node with its defaults, which would have given you npm).
At some point you probably installed some package with npm. Maybe grunt, karma, etc..those by default end up in /usr/local/lib/node_modules.
Maybe one of those packages or its dependencies(or sub-dependencies) depended on phantomjs (I think Karma might use phantomjs?) Anyways, if now you are trying to brew install phantomjs, which is trying to make a symlink to it, that may be conflicting with the already existing symlink that npm created for you..
I think you can change the symlink path for that package so that brew permanently points to that already installed package in the node_modules folder. Sorry not to be more specific, I'm just figuring this out myself.

Resources