homebrew with M1 macbook air error when starting terminals - homebrew

I installed homebrew 3.0.0 on my M1 MBA.
However, every session including iterm2 terminal and tmux shows this error message:
/Users/jinrae/.zprofile:1: no such file or directory: opt/homebrew/bin/brew
In my case, it does not harm functionality at least in my usage pattern.
Anyhow, how can I get rid of this message?

I got this error because I installed brew on the Rosetta version of terminal to install packages, that are not yet M1 compatible.
To get rid of this message i opened my .zprofile with nano .zprofile.
The first line was
eval "$(/opt/homebrew/bin/brew shellenv)"
And i simply put a # before this line to comment it out and the message was gone.

To #sedavidw, /opt/homebrew/bin contains .keepme without contents:
/Users/jinrae/.zprofile:1: no such file or directory: opt/homebrew/bin/brew
➜ bin pwd
/opt/homebrew/bin
➜ bin la
total 0
-rw-r--r-- 1 jinrae admin 0B Feb 9 11:04 .keepme
EDIT: I read an article saying that homebrew is installed in /opt/homebrew/bin in M1 Mac whereas it is installed in /usr/local in Intel Mac. I'm trying to reinstall homebrew for M1 Mac now.
EDIT2: I solved the problem. It was due to for what homebrew is installed. As I heard, homebrew is installed in /usr/local for Intel Mac and /opt/homebrew/bin for M1 Mac.
I reinstalled homebrew with
/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/nrubin29/bea5aa83e8dfa91370fe83b62dad6dfa/raw/48f48f7fef21abb308e129a80b3214c2538fc611/homebrew_m1.sh)"
which is slightly different from that in the official site (at least to me).
Anyhow, newly installed homebrew is located in /opt/homebrew/bin and the problem has been solved.

If you are using an Intel Mac, as mentioned above, Homebrew gets installed on /usr/local. Therefore, modify your .zprofile file (located in users/<username>) to use the correct path. Here is content of .zprofile:
eval "$(/usr/local/Homebrew/bin/brew shellenv)"

I have the M1 Mac and it was installed in /opt/homebrew/...
I opened /Users/~username~/.zprofile and it had two lines.
First line was:
eval "$opt/homebrew/bin/brew shellenv"
Second like was:
eval "$(/opt/homebrew/bin/brew shellenv)"
I just commented out the first line which doesn't actually have the </opt/> in the address. It's asking for a $opt, and then the address. So commenting out that line removed the location error and just read the correct line. So it doesn't show the error anymore when opening the terminal.

To Fix Type
nano .zprofile
then delete all of the stuff
then do ⌃X
then press return

Related

Two 'Homebrew' on my mac; one in opt and one in local. How do I delete one?

I bought a new Mac Studio to replace my old (2013) Mac Pro. I used Homebrew for programming for school; I'm over 75 but I'm going to school (ece) for fun. Thinking it would be a good idea to install a Homebrew for the Apple chipset, I installed Homebrew. But instead of overwriting my old version, it installed a new version in /opt . The old was in /usr/local/bin . How do I delete the old install? Somehow I think having two 'brew's is not a god idea.
I've tried nothing so far. I don't think rmdir -pv on /usr/local/bin/brew would be sufficient. Especially as I don't know where Homebrew store everything and I might end up deleting something I need and don't know I need it.
The Homebrew installation under /usr/local is for Intel and the installation under /opt/homebrew is for M1.
If you want to remove the Intel installation, you can download the official uninstall script. Make it executable with:
chmod +x uninstall.sh
and run it on the Intel installation with:
./uninstall.sh --path=/usr/local

Bad CPU type in executable after migrating to new Macbook

I just got a new Macbook and did the migration from my old one. It looks like the homebrew executables have a bad CPU type and don't work. Things are a bit stuck right now and I'm not sure how to move forward.
Even my ls is mapped to lsd and I can't list files.
Do I have to manually uninstall brew and related executables by deletion and start over?
DISCLAIMER: I didn't test this myself.
If you don't want to alwasy use Rosetta2, you have to manually remove the Intel version of Homebrew, then install the M1 version.
You can save the list of your Intel installed package with:
brew list > myHomebrewPackages.txt
You will then have to reinstall them on the M1 version.
To remove the Intel version, download the uninstall script from the official Homebrew github repository. Make it executable with:
chmod +x uninstall.sh
and run it with:
./uninstall.sh --path=/usr/local
Then install the M1 version with:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The M1 version of Homebrew will be installed under /opt/homebrew.

Not able to install homebrew on my m1 macbook

I am trying to install homebrew on m1 MacBook but I am getting this error message every time when I try to run this command.
Please anyone help me to fix this.
How to install HomeBrew on new MacBook: macOS Big Sur
install HomeBrew from terminal Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installation, we need to change path
Warning: /opt/homebrew/bin is not in your PATH.
==> Installation successful!
To change path, follow Next steps: - Add Homebrew to your PATH in /Users/username/.zprofile As mentioned in terminal:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/username/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
All done ready to use brew, check HomeBrew version:
brew --version
Output
Homebrew 3.1.5
Homebrew/homebrew-core (git revision 5741ae3fec; last commit 2021-05-08)
Ok, I managed to figure this out after being pointed in the right direction. Full details can be found here: https://github.com/Homebrew/homebrew-cask/issues/100633
In summary, my ISPs (Virgin Media) Web Safe Settings were on, and this resulted in some issue with connecting to github (ping GitHub.com via terminal and search the IP to see where its pointing to), so had to turn off the web settings, rebooted my router just in case and used a new terminal window to ping github.com again and noticed a change in the IP address. Tried reinstalling Homebrew again and it worked!!
in my case, i fix the problem open the terminal as rosseta.
finder - application - utility - terminal - right mouse button - 'bring the imformation (i'm not sure, i'm korean user)' - check the 'open with the rosseta' - and try install homebrew again ! !
(copy-paste Homebrew with the terminal)
and...
==> Installation successful!
But, you will get a warning " /opt/homebrew/bin is not in your PATH". Then, follow the Next steps guide showed in terminal to finish add Homebrew to your PATH.
To end, type "brew -v" to check installed brew version.

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!

Prevent warning about Macports/Fink installation

How can I prevent the following warning from Homebrew appearing whenever I install something?
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Note that I've never (that I recall) installed Fink on this machine and I just uninstalled Macports. I've tried removing /opt/local/bin from my PATH to no avail.
Did you follow the official guide? (specially the "rm" part)
Looking at the source (in def macports_or_fink_installed?), it seems to check something like this:
$ which port
$ which fink
$ ls /sw/bin/fink /opt/local/bin/port # if they exist
$ ls -ld /sw /opt/local # if either directory exists it must be readable
It's a dirty hack but if you just want to silence the warning you can comment out the relevant parts of check_macports in $(brew --prefix)/Library/Homebrew/cmd/install.rb.

Resources